manpagez: man pages & more
info bigloo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

16.1 Errors and Warnings

Bigloo permits to signal an error via the error function. Errors are implemented by the means of exceptions (see with-exception-handler, with-handler, and raise forms). Assertions allow the checking of predicates at certain points in programs.

bigloo procedure: typeof obj

Returns a string which is the name of the dynamic type of obj.

bigloo procedure: error proc msg obj

This form signals an error by calling the current error handler with proc, msg and obj as arguments.

(define (foo l)
   (if (not (pair? l))
       (error "foo" "argument not a pair" l)
       (car l)))

(foo 4)
error--> *** ERROR:bigloo:foo:
         argument not a pair -- 4

Switching on the -g compilation switch enables stack dumping when the error function is invoked. That is, when a program is compiled with -g and when, at runtime, the shell variable BIGLOOSTACKDEPTH is set and contains a number, an execution stack of depth BIGLOOSTACKDEPTH is printed when an error is raised.

bigloo procedure: error/location proc msg obj file location

This form signals an error by calling the current error handler with proc, msg and obj as arguments. The error is prompted in file, at character position location.

(define (foo l)
   (if (not (pair? l))
       (error/location
         "foo" "argument not a pair" l "foo.scm" 115)
       (car l)))

(foo 4)
error--> File "foo.scm", line 4, character 115:
         #       (car l)))
         #       ^
         # *** ERROR:bigloo:foo
         # argument not a pair -- 4
             0. FOO
             1. DYNAMIC-WIND
             2. INTERP
             3. ENGINE
             4. MAIN
bigloo procedure: get-trace-stack size
bigloo procedure: dump-trace-stack output-port size

Switching on the -g compilation switch enables stack dumping Compiler description. That is, the list of the pending calls can be dumped by the runtime-system. The function get-trace-stack builds such a trace. The list built by get-trace-stack only contains the size top most pending calls. The function dump-trace-stack displays a representation of this stack on the output-port.

bigloo procedure: warning/location file location [arg]…

This form signals a warning. That is, is arg are displayed on the standard error port. The warning is prompted in file at character position location.

(define (foo l)
   (if (not (pair? l))
       (begin
          (warning/location
            "foo.scm" 154 "foo:" "argument not a pair -- " l)
          '())
       (car l)))

(foo 4)
-| File "foo.scm", line 6, character 154:
   #       (car l)))
   #       ^
   # *** WARNING:bigloo:foo:
   argument not a pair -- 4
⇒ '()
bigloo procedure: exception-notify exc
bigloo procedure: error-notify err
bigloo procedure: warning-notify err

Display a message describing the error or warning on the default error port.


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

This document was generated on March 31, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.