In Oracle, we used to use RAISE_APPLICATION_ERROR to raise exceptions and terminate the execution of the program immediately. What could be the way here?
The context of why I’m trying to do this
I have written a macro which has 100 lines of code; In middle of code; based on some condition, I want to raise the error and terminate the code immediately.
What I’ve already tried
I have done logging of the error and used IF/ELSE to process. But this will not fail the program or raise the error. I checked exceptions | dbt Developer Hub ; But this show “raise_compiler_error” and not the exception which might occur during execution.
Can you provide the code that you’re running which isn’t raising an exception? As Josh noted, the exceptions object that you found should behave the way you’re hoping.
Or have you not tried it because it calls itself a compiler error instead of a runtime error? dbt will compile your code (including running any introspective queries) before running it, which means that a compiler error is correct.