# 7.12 Raising exceptions

Pyxplot’s `raise(e,s)` function is used to raise exceptions when error conditions are met. Its first argument `e` specifies the type of exception, and should be an object of type `exception`. The second argument should be an error message string. Pyxplot has a range of default exception types, which can be found as `exception` objects in the module `exceptions`. Alternatively, the object `types.exception` may be called with a single string argument to make a new exception type. For example:

    raise(exceptions.syntax , "Input could not be parsed")

    a=types.exception("user error")
    raise(a, "The user made a mistake")

Alternatively, `exception` objects have a method `raise(s)` which can be called as follows:

    a=types.exception("user error")
    a.raise("The user made a mistake")