Handle channel exceptions
Channel errors can be trapped with the WHENEVER ERROR
exception
handler:
WHENEVER ERROR CONTINUE
CALL ch.write([num,label])
IF STATUS THEN
ERROR "An error occurred while reading from Channel"
CALL ch.close()
RETURN -1
END IF
WHENEVER ERROR STOP
Or with a TRY/CATCH
block:
TRY
CALL ch.write([num,label])
CATCH
ERROR "An error occurred while reading from Channel"
CALL ch.close()
RETURN -1
END TRY