> David Fox writes
> Sometimes five levels of traceback isn't enough to diagnose an
> error.  When constructing an STklos object it just gets you up
> to "make-instance".  It would be nice to be able to set the
> amount of traceback to be printed.
You can easily change this: when an error occurs, the C routine STk_err
looks if a function called report-error exists. If it is not the case, it use
a default function (in C) which shows only the 5 topmost stack items.
report-error has 3 parameters a header (which contain generally the error type)
the message itself and the object which cause the error (NIL if none, a bad 
idea but ...)
You can use the functions %get-eval-stack and %get-environment-stack to obtain 
the eval and environment stack.
You can have a look in Lib/error.stk for an example
Hereafter is a simple non-graphical error reporter.
(define (report-error head message obj)
  (let ((port (current-error-port)))
    ;; Display message
    (format port "~A: ~A ~S\n\n"  head message obj)
    ;; Display stack
    (let ((stack (%get-eval-stack))
          (env   (%get-environment-stack)))
      (for-each (lambda (x y) (format port "~A ~A\n" x (uncode y)))
                env 
                stack))))
It should be documented but I don't really know where this kind of information
should go (probably in the FAQ, even if not so frequently asked...).
                -- Erick
Received on Mon Apr 29 1996 - 10:57:10 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST