Forum Post: RE: Gotchas with ROUTINE-LEVEL in ChUI procedures?

  • Thread starter Thread starter Dustin Grau
  • Start date Start date
Status
Not open for further replies.
D

Dustin Grau

Guest
Sorry I couldn't reply sooner. Yes, I understand that error handling _should_ be the same whether it's character, GUI, or speedscript, so don't worry about the singling-out of the character bit. I too set up a test case that shows a curious effect with the error-status:error lingering beyond the scope of the original program. I have 3 programs for testing: a primary caller, and 2 error-producing tests (1 with routine-level and 1 without). When not using routine-level the error-status:error does stay isolated to just the called program. But when calling the program that contains routine-level, the calling program will not only catch any errors from the called program but will still see error-status:error as set. Are you saying this is not the expected behavior? Here is my code. Sorry, I don't yet know how to format it as a code block by default. Caller: {src/web/method/wrap-cgi.i} {&OUT} "Running 'no-routine' test... br/ ". RUN tools/err_test-no_routine.p. IF ERROR-STATUS:ERROR THEN {&OUT} "An error status still exists after 'no-routine' call: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". {&OUT} " br/ ". {&OUT} "Running 'with-routine' test... br/ ". RUN tools/err_test-with_routine.p. IF ERROR-STATUS:ERROR THEN {&OUT} "An error status still exists after 'with-routine' call: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". CATCH err AS Progress.Lang.Error: {&OUT} " hr/ ". IF ERROR-STATUS:ERROR THEN {&OUT} "An error status still exists within catch block: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". {&OUT} SUBSTITUTE("Caught Error: [&1] &2", err:GetMessageNum(1), err:GetMessage(1)). END CATCH. Program without routine-level: /* No ROUTINE-LEVEL */ {src/web/method/wrap-cgi.i} PROCEDURE causeError: DEFINE VARIABLE myInt AS INTEGER NO-UNDO. DO: ASSIGN myInt = INTEGER("a") NO-ERROR. IF ERROR-STATUS:ERROR THEN {&OUT} "An error status exists after 'a' assignment: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". {&OUT} "Assigning 'b' value, check log for details of failure... br/ ". ASSIGN myInt = INTEGER("b"). IF ERROR-STATUS:ERROR THEN {&OUT} "An error status exists after 'b' assignment: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". END. END PROCEDURE. /* Main Block */ RUN causeError. Program with routine-level: ROUTINE-LEVEL ON ERROR UNDO, THROW. {src/web/method/wrap-cgi.i} PROCEDURE causeError: DEFINE VARIABLE myInt AS INTEGER NO-UNDO. DO: ASSIGN myInt = INTEGER("c") NO-ERROR. IF ERROR-STATUS:ERROR THEN {&OUT} "An error status exists after 'c' assignment: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". {&OUT} "Assigning 'b' value, check log for details of failure... br/ ". ASSIGN myInt = INTEGER("d"). IF ERROR-STATUS:ERROR THEN {&OUT} "An error status exists after 'd' assignment: " + ERROR-STATUS:GET-MESSAGE(1) + " br/ ". END. END PROCEDURE. /* Main Block */ RUN causeError.

Continue reading...
 
Status
Not open for further replies.
Back
Top