Lisp HUG Maillist Archive

backtrace and conditions


I have such a code:

(catch 'handler-done
  (handler-bind ((error #'(lambda (condition)
                            (when *scgi-ignore-errors*
                              (log-error-condition condition path)
                              (throw 'handler-done nil)))))
    (funcall function request))) ; <- do request


When an error occurs I log it and continue to carry on. The function log-error-condition has something like this (format nil "~a" condition). 

Question: how can I also log the backtrace of the stack frames where code has fired condition?

Best,
 Art


Re: backtrace and conditions

Art Obrezan wrote on Sat, 12 Feb 2011 18:00:17 -0800 (PST) 05:00:

| I have such a code:
|
| (catch 'handler-done
|   (handler-bind ((error #'(lambda (condition)
|                             (when *scgi-ignore-errors*
|                               (log-error-condition condition path)
|                               (throw 'handler-done nil)))))
|     (funcall function request))) ; <- do request
|
|
| When an error occurs I log it and continue to carry on. The function
| log-error-condition has something like this (format nil "~a"
| condition).
|
| Question: how can I also log the backtrace of the stack frames where code
has
| fired condition?

You can try the following (excerpt from Ystok-Widgets):

(with-open-file (*debug-io* pathname
                       :direction :output
                       :if-does-not-exist :create)
    (dbg:with-debugger-stack ()
      (dbg:bug-report-form '(:b) "Bug report")))

Caution: The debugger is eliminated from the image delivered at level 5 by
default,
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:38 UTC