Capítulo 7. Advanced Programming with GEL
Anterior |  | Próxima

# Capítulo 7. Advanced Programming with GEL

## Error Handling

If you detect an error in your function, you can bail out of it. For normal errors, such as wrong types of arguments, you can fail to compute the function by adding the statement `bailout`. If something went really wrong and you want to completely kill the current computation, you can use `exception`.

For example if you want to check for arguments in your function. You could use the following code.

    function f(M) = (
      if not IsMatrix (M) then (
        error ("M not a matrix!");
        bailout
      );
      ...
    )

Anterior |  | Próxima
Lvalues | Principal | Toplevel Syntax