Error Code: EXCEPTION
This guide presents use cases where an exception error may occur and describes how to fix it.
Even if an expression is syntactically correct, it may trigger an error during execution. These are called exceptions.
Exceptions can occur for many reasons. For instance, consider the following example:
def json = parse_json["result"]
This outputs an exception due to a wrong argument passed to the Rel built-in relation parse_json
.
The argument "result"
doesn’t follow the expected JSON structure.
Another source of exceptions is nonconvergent computation, which is common when you’re using recursion.
For instance, you may experience an unbound domain, i.e., recursive computations where there’s no fixpoint or where a fixpoint takes infinitely many iterations to reach.
This happens in the following example where you compute the factorial but don’t state the fixpoint n
:
def F[0] = 1
def F[n] = n * F[n-1]
This is the output:
See Common Pitfalls in the Recursion guide for more details.
Finally, Rel ungrounded variables also return exceptions as error messages. See the Ungrounded Variable Error for more details.
Generally, to handle the exception, you need to fix the error that is triggering it. See the List of Error Messages for more details.
Note that the RAI Console helps you detect errors by displaying some information related to the error in the Message
and Report
fields.
The same happens when using the RelationalAI SDKs.
See the Result Structure section in any of the RelationalAI SDKs for more details.