4 Errortrace Library

▼ |  | Errortrace: Debugging and Profiling

1 | Quick Instructions
2 | Installing Errortrace
3 | Using Errortrace
4 | Errortrace Library
5 | Re-using Errortrace Stack Tracing
6 | Errortrace Key

On this page:

errortrace-compile-handler
make-errortrace-compile-handler
errortrace-error-display-handler
errortrace-annotate
annotate-top

top contents ← prev up next →

## 4 Errortrace Library🔗ℹ

(require errortrace/errortrace-lib)
| package: errortrace-lib

The errortrace/errortrace-lib module exports all of the exports of errortrace, plus a few more. It does not install any handlers.

The additional exports are as follows:

> > procedure
> > (errortrace-compile-handler |  | stx |
> > |  | immediate-eval?) |
> → compiled-expression?
> stx : any/c
> immediate-eval? : any/c

Compiles stx using the compilation handler that was active when the errortrace/errortrace-lib module was executed, but first instruments the code for Errortrace information. The code is instrumented only if

> (list (namespace-module-registry (current-namespace))
> (namespace-base-phase (current-namespace)))

is the same as when the errortrace/errortrace-lib module was executed. This procedure is suitable for use as a compilation handler via current-compile.

> procedure (make-errortrace-compile-handler)
> → (-> any/c any/c compiled-expression)

Produces a compile handler that is like errortrace-compile-handler, except that the code that it produces is instrumented if the value of

> (namespace-module-registry (current-namespace))

is the same as when the original thunk is invoked.

In addition, when the thunk is invoked, it uses namespace-attach-module to attach the errortrace/errortrace-key module and the '#%kernel module to the current-namespace.

> > procedure
> > (errortrace-error-display-handler |  | string |  |  |  |
> > |  | exn) |  | → |  | void?
> string : string?
> exn : exn?

Displays information about the exception; this procedure is suitable for use as an error display handler.

> procedure (errortrace-annotate stx) → any/c
> stx : any/c

Macro-expands and instruments the given top-level form. If the form reads as a module whose first subexpression is (void '#:errortrace-dont-annotate) or is a module whose name is errortrace-key, then no instrumentation is applied. See the signature element errortrace-annotate (of stacktrace/errortrace-annotate^) for more detail.

This annotation function is used by errortrace-compile-handler.

Changed in version 1.5 of package errortrace-lib: Generalized predicate for skippable modules to those using '#:errortrace-dont-annotate

> procedure (annotate-top stx phase-level) → any/c
> stx : any/c
> phase-level : exact-integer?

Like errortrace-annotate, but given an explicit phase level for stx; (namespace-base-phase) is typically the right value for the phase-level argument.

Unlike errortrace-annotate, there no special case for a module named errortrace-key or with '#:errortrace-dont-annotate. Also, if stx is a module declaration, it is not enriched with imports to explicitly load Errortrace run-time support.

top contents ← prev up next →