Hello everyone!
What's wrong with that,as I cant get the message fired...?? All I get is a Stop Condition...
TIA
Will not the NO-ERROR suppress the error being thrown?
Catch won't catch a stop.
1) NO-ERROR is preventing any CATCH activity
2) To CATCH a STOP Condition, you need an extra procedure layer and then
DO ON STOP UNDO, RETURN ERROR NEW Progress.Lang.AppError ("Stop was here!", 0) .
Hello everyone!
What's wrong with that,as I cant get the message fired...´??
TIA
Flag this post as spam/abuse.
Hello everyone!
What's wrong with that,as I cant get the message fired...´??
TIA
Flag this post as spam/abuse.
Flag this post as spam/abuse.
Thanks Mike and James...
I've tried the "Put catch block outside..." part but to not avail.... how would you do it?
Mike.. the "ON STOP UNDO, goes inside the new layer (procedure)?
a quick dirty brief example would be very appreciated , as in:
do on error....
run proc1.p("FILETORUN").
catch...
end.
proc1..
do on stop...
run value...
end.
Is this the proper sequence?
TIA
I did this, but it won't get to the message from the catch block, and neither to the last message of the original block , that means that it escaped form the block (I'm testing tin the scratch pad.)
The avm noted the STOP as the "Stop was here" message is present, but it honors the condition and gets it done (to break the stack of programs?)
Oddly enough, I don't get the messages realized, but I get the "Stop was here" message ... (where did it came from?)
If we change SysError to AppErrror, the messge goes to parent frame and not to a alert-box...
I did this, but it won't get to the message from the catch block, and neither to the last message of the original block , that means that it escaped form the block (I'm testing tin the scratch pad.)
The avm noted the STOP as the "Stop was here" message is present, but it honors the condition and gets it done (to break the stack of programs?)
Oddly enough, I don't get the messages realized, but I get the "Stop was here" message ... (where did it came from?)
If we change SysError to AppErrror, the messge goes to parent frame and not to a alert-box...
Flag this post as spam/abuse.
Sorry... I missed that simpole part!!
thanks and good night to you!
If you want to catch all possible errors, you could catch Progress.Lang.Error
After all, I ended with this testing procedure, hope they serve to someone starting to learning like me:
----- Main procedure file:
BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
RUN runWithError.
MESSAGE "No error"
VIEW-AS ALERT-BOX.
END.
CATCH myE AS Progress.Lang.SysError:
MESSAGE "Catched that Sys error..."
VIEW-AS ALERT-BOX.
END CATCH.
CATCH myA AS Progress.Lang.AppError:
MESSAGE "Catched that App error..." SKIP
"Retrurn value: " myA:returnvalue
VIEW-AS ALERT-BOX.
END CATCH.
/*end of Main Block */
PROCEDURE runWithError.
DEFINE VARIABLE foo AS CHAR NO-UNDO.
DO ON STOP UNDO, RETURN ERROR NEW Progress.Lang.AppError("AppError generated msg", 0):
MESSAGE "Do you want a AppError, SysError or No error at All (yes,no,cancel, respectivelly)"
VIEW-AS ALERT-BOX BUTTONS YES-NO-CANCEL UPDATE resp AS LOGICAL.
IF resp THEN
RUN nofile.p. /* this file is absent form propath */
ELSE IF NOT resp THEN
DO:
foo = STRING(999, ">>"). /* sys error */
END.
ELSE
RETURN.
END.
END.
Greetings