postscript Error Handling Catching an error


Example

Since the final action of the default error handler is to call stop, you can catch errors from operators by enclosing code in a { ... } stopped construct.

{
    0 array
    1 get
} stopped {
    $error /errorname get =
} if

will print "rangecheck", the error signaled by get when the index is outside the acceptable range for that array.