Documentation
¶
Overview ¶
Package exceptions provides R7RS exception handling primitives.
Exception Handling (R7RS 6.11) ¶
- with-exception-handler: install exception handler
- raise: raise non-continuable exception
- raise-continuable: raise continuable exception
Error Construction ¶
- error: create error with message and irritants
- error-object?: test if value is error object
- error-object-message: get error message
- error-object-irritants: get error irritants
Error Predicates ¶
- read-error?: test for read errors
- file-error?: test for file errors
Use Extension or AddToRegistry to register all primitives.
Package exceptions provides exception handling primitives.
Index ¶
- Variables
- func PrimError(mc *machine.MachineContext) error
- func PrimErrorObjectIrritants(mc *machine.MachineContext) error
- func PrimErrorObjectMessage(mc *machine.MachineContext) error
- func PrimErrorObjectQ(mc *machine.MachineContext) error
- func PrimFileErrorQ(mc *machine.MachineContext) error
- func PrimRaise(mc *machine.MachineContext) error
- func PrimRaiseContinuable(mc *machine.MachineContext) error
- func PrimReadErrorQ(mc *machine.MachineContext) error
- func PrimWithExceptionHandler(mc *machine.MachineContext) error
Constants ¶
This section is empty.
Variables ¶
var AddToRegistry = Builder.AddToRegistry
AddToRegistry registers all exception primitives.
var Builder = registry.NewRegistryBuilder(addPrimitives)
Builder aggregates all exception registration functions.
var Extension = registry.NewExtension("exceptions", AddToRegistry)
Extension is the exceptions extension.
Functions ¶
func PrimError ¶
func PrimError(mc *machine.MachineContext) error
PrimError implements the error primitive. (error message irritant ...) Creates an error object with the given message and irritants, then raises it.
func PrimErrorObjectIrritants ¶
func PrimErrorObjectIrritants(mc *machine.MachineContext) error
PrimErrorObjectIrritants implements the error-object-irritants accessor. Returns the list of irritant objects from an error object.
func PrimErrorObjectMessage ¶
func PrimErrorObjectMessage(mc *machine.MachineContext) error
PrimErrorObjectMessage implements the error-object-message accessor. Returns the message string from an error object.
func PrimErrorObjectQ ¶
func PrimErrorObjectQ(mc *machine.MachineContext) error
PrimErrorObjectQ implements the error-object? predicate. Returns #t if the argument is an error object created by (error ...), #f otherwise.
func PrimFileErrorQ ¶
func PrimFileErrorQ(mc *machine.MachineContext) error
PrimFileErrorQ implements the file-error? predicate. R7RS §6.11: Returns #t if obj is an error object raised during file operations.
func PrimRaise ¶
func PrimRaise(mc *machine.MachineContext) error
PrimRaise implements the raise primitive. (raise obj) Raises a non-continuable exception with obj as the condition.
func PrimRaiseContinuable ¶
func PrimRaiseContinuable(mc *machine.MachineContext) error
PrimRaiseContinuable implements the raise-continuable primitive. (raise-continuable obj) Raises a continuable exception with obj as the condition. If the handler returns, its return value becomes the value of raise-continuable, and execution continues from the call site per R7RS §6.11.
func PrimReadErrorQ ¶
func PrimReadErrorQ(mc *machine.MachineContext) error
PrimReadErrorQ implements the read-error? predicate. R7RS §6.11: Returns #t if obj is an error object raised during reading.
func PrimWithExceptionHandler ¶
func PrimWithExceptionHandler(mc *machine.MachineContext) error
PrimWithExceptionHandler implements the with-exception-handler primitive. (with-exception-handler handler thunk) Installs handler as exception handler during thunk execution.
Types ¶
This section is empty.