Error Handling

Soft limits

A minimum and maximum can be specified for a numerical parameter in the metadata of a funtion, see Writing a new function:

../_images/Error1.png

When a user attempts to put a value in that’s out of range, the parameter will turn yellow:

../_images/Error2.png

If the user decides to ignore the warning and adds the macro to the queue, there is a pop-up to confirm:

../_images/Error3.png

Exceptions and hard limits

You can put a hard limit for any parameter by raising an exception.

Any exception, either intentional or not, will pause the queue, cancel the current macro, and create a pop-up showing the exception that was raised.:

# {"Name":"SomeParameter","Max":10}
def Exception_Function(SomeParameter=5):
    if SomeParameter > 10:
        raise ValueError(f"{SomeParameter} is too large.")
../_images/Error4.png