www.delorie.com/gnu/docs/guile/guile_305.html   search  
Buy GNU books!

Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

26.10 How to Handle Errors in C Code

Error handling is based on catch and throw. Errors are always thrown with a key and four arguments:

In addition to catch and throw, the following Scheme facilities are available:

Scheme Procedure: scm-error key subr message args rest
Throw an error, with arguments as described above.

Scheme Procedure: error msg arg ...
Throw an error using the key 'misc-error. The error message is created by displaying msg and writing the args.

Scheme Procedure: display-error stack port subr message args rest
C Function: scm_display_error (stack, port, subr, message, args, rest)
Display an error message to the output port port. stack is the saved stack for the error, subr is the name of the procedure in which the error occurred and message is the actual error message, which may contain formatting instructions. These will format the arguments in the list args accordingly. rest is currently ignored.

The following are the error keys defined by libguile and the situations in which they are used:

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003