Next: Breaks Up: Built-in Parameters Previous: Libraries

### Exceptions

- `(current-exception-handler [proc])` gets or sets a procedure that is invoked to handle an exception. See section 8.1 for more information about exceptions.
- `(error-escape-handler [proc])` gets or sets a procedure that takes no arguments and escapes from the dynamic context of an exception. The default error escape handler escapes to the start of the current thread, but `read-eval-print-loop` (see section 14.1) also sets the escape handler. To report a run-time error, use `raise` (see section 8.1) or `error` (see section 8.2) instead of calling the error escape procedure directly. If an exception is raised while the error escape handler is executing, an error message is printed using a primitive error printer and the primitive error escape handler is invoked. Unlike all other parameters, the value of the `error-escape-handler` parameter in a new thread is not inherited from the creating thread; instead, the parameter is always initialized to the default error escape handler.
- `(error-display-handler [proc])` gets or sets a procedure that takes a string to print as an error message. This error display handler is called by the default exception handler. The default error display handler `display`s its argument to the current error port (determined by the `current-error-port` parameter). To report a run-time error, use `raise` (see section 8.1) or `error` (see section 8.2) instead of calling the error display procedure directly. If an exception is raised while the error display handler is executing, an error message is printed using a primitive error printer and the primitive error escape handler is invoked.
- `(error-print-width [k])` gets or sets an integer greater than `3`. This value is used as the maximum number of characters used to print a Scheme value that is embedded in a primitive error message.
- `(error-value->string-handler [proc])` gets or sets a procedure that takes an arbitrary Scheme value and an integer and returns a string. This error value conversion handler is used to to print a Scheme value that is embedded in a primitive error message. The integer argument to the handler specifies the maximum number of characters that should be used to represent the value in the resulting string. The default error value conversion handler `write`s the value into a string; if the printed form is too long, the printed form is truncated and the last three characters of the return string are set to ``...''.

  If the string returned by an error value conversion handler is longer than requested, the string is destructively ``truncated'' by setting the first extra position in the string to the null character. If a non-string is returned, then the string `"..."` is used. If a primitive error string needs to be generated before the handler has returned, the default error value conversion handler is used.

Next: Breaks Up: Built-in Parameters Previous: Libraries