TRY/CATCH in Genero BDL: what it captures and what it does not (quick guide)
A TRY/CATCH around a call seems like a complete safety net: if something fails inside the function, the CATCH will handle it. In Genero BDL it does not work this way, and not knowing this leads to programs that stop without passing through the CATCH or to errors that pass silently. The problem: a TRY that does not jump. Look at this program. Each call is inside its own TRY and each function fails: one divides…
In Genero BDL, a TRY/CATCH block only covers the specific lines of code written within its scope and does not automatically catch errors from called functions. Because TRY acts as a pseudoinstruction rather than generating dedicated code, errors such as division by zero or missing files in a separate function will either be ignored or cause the program to stop unexpectedly.
To ensure that errors from a function are propagated back to the caller's TRY/CATCH block, developers must use the WHENEVER ANY ERROR RAISE directive. This directive must be present within the specific module where the error occurs to properly redirect the exception to the calling routine.
Summarised by urgent.news, not translated. Machine-written; may contain errors — check the original.
Source: dev.to
More from Dev.to on urgent.news
Report a problem with this story
Get the day's news by email. Daily, weekly or monthly. Sign up