Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
psiquetp
- Junior Coder
- Posts: 25
- Joined: Tue Jul 17, 2018 7:56 pm
Post
by psiquetp » Thu Jul 19, 2018 5:17 pm
I want my code to report abnormal termination; that is, to run a routine that in case of an error it might report them, close resources, send an email, or whatever.
So that means that after the subroutine the program should end... I tried to create the routine and goto a label at the end of the macro but the scheduler is sending an error message about branching out from subs... is there any other way to terminate the execution than to reach the end? can the error message be muted?
Code: Select all
//Subroutine to report an error -----------------------------
//Input: ERROR_MESSAGE .- String to be displayed as the error.
SRT>ReportError
MessageModal>%ERROR_MESSAGE%
Goto>EndOfMacro
END>ReportError
....
Label>EndOfMacro
Thank you!
Carlos Alberto
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Thu Jul 19, 2018 5:59 pm
Just put an Exit statement in your subroutine:
Code: Select all
SRT>ReportError
MessageModal>%ERROR_MESSAGE%
Exit>0
END>ReportError