On error .. throw: Catch... missing precious info.

Posted by OctavioOlguin on 09-Feb-2015 11:08

Hello everyone!

BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
    RUN asdfsd no-error.
    CATCH myS AS Progress.Lang.SysError:
        MESSAGE "Error file not found!!!:  " myS:GetMessage(1).
    END CATCH.
END.

What's wrong with that,as I cant get the message fired...??  All I get is a Stop Condition...

TIA

All Replies

Posted by Roger Blanchard on 09-Feb-2015 11:14

Will not the NO-ERROR suppress the error being thrown?

Posted by Thomas Mercer-Hursh on 09-Feb-2015 11:45

Catch won't catch a stop.

Posted by Mike Fechner on 09-Feb-2015 12:44

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) .

Posted by James Palmer on 09-Feb-2015 12:49

Put the catch outside the do block, and with block level you don't need the on error as far as I know.

James Palmer | Application Developer
Tel: 01253 785103

[collapse] From: OctavioOlguin
Sent: ‎09/‎02/‎2015 17:10
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] On error .. trow:  Catch... missing precious info.

Thread created by OctavioOlguin

Hello everyone!

BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
    RUN asdfsd no-error.
    CATCH myS AS Progress.Lang.SysError:
        MESSAGE "Error file not found!!!:  " myS:GetMessage(1).
    END CATCH.
END.

What's wrong with that,as I cant get the message fired...´??

TIA

Stop receiving emails on this subject.

Flag this post as spam/abuse.




This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
[/collapse]

Posted by James Palmer on 09-Feb-2015 12:51

Ignore me I misunderstood!

James Palmer | Application Developer
Tel: 01253 785103

[collapse] From: James Palmer
Sent: ‎09/‎02/‎2015 18:51
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] On error .. trow:  Catch... missing precious info.

Reply by James Palmer
Put the catch outside the do block, and with block level you don't need the on error as far as I know.

James Palmer | Application Developer
Tel: 01253 785103

[collapse] From: OctavioOlguin
Sent: ‎09/‎02/‎2015 17:10
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] On error .. trow:  Catch... missing precious info.

Thread created by OctavioOlguin

Hello everyone!

BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
    RUN asdfsd no-error.
    CATCH myS AS Progress.Lang.SysError:
        MESSAGE "Error file not found!!!:  " myS:GetMessage(1).
    END CATCH.
END.

What's wrong with that,as I cant get the message fired...´??

TIA

Stop receiving emails on this subject.

Flag this post as spam/abuse.




This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
Stop receiving emails on this subject.

Flag this post as spam/abuse.




This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
[/collapse][/collapse]

Posted by OctavioOlguin on 09-Feb-2015 13:07

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

Posted by OctavioOlguin on 09-Feb-2015 14:24

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...

BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
    RUN runfile.
    MESSAGE "Still runing original block"
    VIEW-AS ALERT-BOX.
END.
CATCH myS AS Progress.Lang.SysError:
    MESSAGE "Error file not found!!!:  " myS:GetMessage(1).
END CATCH.
PROCEDURE RUNfile.
    DO ON STOP UNDO, RETURN ERROR NEW Progress.Lang.AppError ("Stop was here!", 0) .
        RUN asdfsd .
    END.
END PROCEDURE.

Posted by Mike Fechner on 09-Feb-2015 14:27

You throw an AppError – so you need to catch the AppError.
 
Your catch is only for SysError.
 
The rest looks o.k.!
Von: OctavioOlguin [mailto:bounce-OctavioOlguin@community.progress.com]
Gesendet: Montag, 9. Februar 2015 21:25
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] On error .. throw: Catch... missing precious info.
 
Reply by OctavioOlguin

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...

BLOCK-LEVEL ON ERROR UNDO, THROW.
DO ON ERROR UNDO, THROW:
    RUN runfile.
    MESSAGE "Still runing original block"
    VIEW-AS ALERT-BOX.
END.
CATCH myS AS Progress.Lang.SysError:
    MESSAGE "Error file not found!!!:  " myS:GetMessage(1).
END CATCH.
PROCEDURE RUNfile.
    DO ON STOP UNDO, RETURN ERROR NEW Progress.Lang.AppError ("Stop was here!", 0) .
        RUN asdfsd .
    END.
END PROCEDURE.
Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by OctavioOlguin on 09-Feb-2015 16:21

Sorry... I missed that simpole part!!

thanks and good night to you!

Posted by bronco on 13-Feb-2015 00:19

If you want to catch all possible errors, you could catch Progress.Lang.Error

Posted by OctavioOlguin on 17-Feb-2015 10:40

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 

This thread is closed