Relevance Language error handling

(imported topic written by SarahGalvan)

Is it possible to trap/catch/handle (whatever you want to call it) errors that your Relevance expression may produce?

Thank you!

(imported comment written by SystemAdmin)

Have you tried using the fixlet debugger?

(imported comment written by SarahGalvan)

I am trying to silence certain unavoidable (by design, please take my word for it) errors my analysis properties may produce.

As a side question, do such errors make it to any external logs? An Analysis with a property that failed.

Thank you!

(imported comment written by SarahGalvan)

Essentially, this is a last ditch effort if I can’t get some other problems sorted out and time runs out.

(imported comment written by SystemAdmin)

Without more detail it will be tough to give an exact answer, however here are some thoughts.

  1. If a statement generates an error in an analysis, you can mouse over the and it will tell you what the error was.

  2. If you are looking to silence the errors you can use “nothing” in some cases. For instance: (if (exists file “c:\abc.txt”) then (lines of file “c:\abc.txt”) else (nothing)) - This will tell clients without “c:\abc.txt” to report nothing.

  3. The relevance debugger will give errors. If you use the graphical debugger it can pinpoint where the error is in the statement

  4. Perhaps if you share some of the relevance and more specifically what you are looking for?

(imported comment written by jeremylam)

The 8.0 platform introduced the pipe (|) operator, which can be used carefully to catch errors:

q: (name of file "C:\does\not\exist") | "does not exist"
A: does not exist
I: singular string

Keep in mind that it must be the same type as the expression being evaluated. The expression on the left hand side must be the same type as the one of the right:

q: file "C:\does\not\exists" | "does not exist"
E: Incompatible types.
 
q: value "test" of key "HKLM\does not exist" of registry | "registry key error"
E: Incompatible types.
 
q: (value "test" of key "HKLM\does not exist" of registry) as string| "registry key error"
A: registry key error
I: singular string