klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

errors.texi (2119B)


      1 @c -*-texinfo-*-
      2 @setfilename ../src/errors
      3 
      4 @node Errors, Libraries, Bytevectors, Top
      5 @comment  node-name,  next,  previous,  up
      6 
      7 @chapter Errors
      8 @cindex Errors
      9 
     10 An error object contains information that can be used to describe an
     11 error that occured in the klisp system.  The interpreter will pass an
     12 error object to an error continuation whenever it needs to signal that
     13 an error occured while executing a program or evaluating an
     14 expression.
     15 
     16 An error object contains a message describing the situation and a
     17 (possibly empty) list of objects, called its irritants, that provide
     18 some context or additional info depending on the error condition.  The
     19 error type is encapsulated.
     20 
     21 Notice that unlike in most other languages, the error object in klisp
     22 isn't used to classify the error in error handlers, the error
     23 continuation being passed the error object is used for that.  The
     24 error object is used only to convey additional info, not the type of
     25 error.
     26 
     27 SOURCE NOTE: The type of object passed to the error continuation is
     28 not specified in the Kernel Report.  This type was inspired by r7rs
     29 scheme.
     30 
     31 @deffn Applicative error-object? (error-object? . objs)
     32 The primitive type predicate for type error.  @code{error-object?}
     33 returns true iff all the objects in @code{objects} are of type
     34 error.
     35 @end deffn
     36 
     37 @deffn Applicative error (error msg . objs)
     38 Create an error object with message @code{msg} and irritants the list
     39 of objects @code{objs} and then send that error object to the error
     40 continuation.  This is the recommended way to signal an error in
     41 klisp.
     42 @end deffn
     43 
     44 @deffn Applicative raise (raise obj)
     45 Send @code{obj} to the error continuation.  @code{obj} needs not be an
     46 error object, any kind of object can be sent to the error continuation
     47 (but that's not recommended!).
     48 @end deffn
     49 
     50 @deffn Applicative error-object-message (error-object-message error)
     51 Applicative @code{error-object-message} extracts the message of
     52 @code{error}.
     53 @end deffn
     54 
     55 @deffn Applicative error-object-irritants (error-object-irritants error)
     56 Applicative @code{error-object-irritants} extracts the irritants of
     57 @code{error}.
     58 @end deffn