report-error
The STk library includes a default report-error procedure that posts a dialog box containing the error message and offers the user a chance to see a stack trace showing where the error occurred and its associated environment.
If an error occurs while is report-error execution, the interpreter detect that the procedure is buggy and it redirect further messages on the standard error port.
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))))
