(sigil exceptions)
(sigil exceptions) - Exception Handling (DEPRECATED)
This module is deprecated. Use (sigil error) instead. This module re-exports all symbols from (sigil error) for backward compatibility.
Exports
make-exceptionprocedureCreate an exception with the given kind, message, and irritants.
Re-exported from (sigil core)
make-exception-with-traceprocedureCreate an exception with stack trace.
Re-exported from (sigil core)
exception?procedureCheck if obj is an exception.
Re-exported from (sigil core)
exception-kindprocedureGet the kind of an exception (e.g., 'error, 'type-error).
Re-exported from (sigil core)
exception-messageprocedureGet the message from an exception.
Re-exported from (sigil core)
exception-irritantsprocedureGet the irritants (additional data) from an exception.
Re-exported from (sigil core)
exception-stack-traceprocedureGet the stack trace from an exception.
Re-exported from (sigil core)
raiseprocedureRaise an exception (non-continuable). The compiler compiles direct calls to OP_RAISE (which handles stack trace attachment and searches the VM exception handler stack). This Scheme wrapper exists for first-class use (e.g. apply/map).
Re-exported from (sigil core)
raise-continuableprocedureRaise a continuable exception. The handler can return a value to continue execution.
Re-exported from (sigil core)
errorprocedureConvenience function to raise an error exception. (error "message" irritant ...)
Re-exported from (sigil core)
with-exception-handlerprocedureInstall an exception handler and execute thunk (R6RS style). Handler is a procedure taking the exception. Thunk is the body to execute.
Re-exported from (sigil core)
current-exception-handlerprocedureGet the current exception handler.
Re-exported from (sigil core)
make-errorprocedureCreate a generic error exception.
(raise (make-error "Something went wrong"))
(raise (make-error "Invalid input" input-value))Re-exported from (sigil error)
error?procedureTest if an exception is a generic error.
Re-exported from (sigil error)
type-error?procedureTest if a value is a type-error struct.
Re-exported from (sigil error)
range-error?procedureTest if a value is a range-error struct.
Re-exported from (sigil error)
arity-error?procedureTest if a value is a arity-error struct.
Re-exported from (sigil error)
guardsyntaxRe-exported from (sigil error)
print-exceptionprocedurePrint an exception to standard output.
(guard (exn
(else (print-exception exn)))
(error "failed"))Re-exported from (sigil error)
format-exceptionprocedureFormat an exception as a human-readable string.
Works with both old-style exception vectors and new error structs. Includes the error kind, message, structured fields, and stack trace.
(guard (exn
(else (display (format-exception exn))))
(error "something failed"))
; Error (error): something failedRe-exported from (sigil error)
format-stack-traceprocedureFormat a stack trace as a string.
By default, only shows frames with named functions, hiding anonymous lambdas to reduce noise from macro expansion and internal implementation. Pass #t to show all frames including anonymous ones.
(format-stack-trace (exception-stack-trace exn))
; => "0: my-function\n at main.sgl:42:5\n ..."
(format-stack-trace (exception-stack-trace exn) #t) ; show allRe-exported from (sigil error)