[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: capturing backtraces
From: |
Nic Ferrier |
Subject: |
Re: capturing backtraces |
Date: |
Sun, 24 Aug 2014 22:14:06 +0100 |
Nic Ferrier <address@hidden> writes:
> (condition-case err
> (thing-that-causes-errors)
> (error (setq saved-backtrace
> (way-to-get-backtrace-from-error err))))
>
> Where the function way-to-get-backtrace-from-error represents a function
> that can get the backtrace from an error.
Aha. Something like this works:
(defun nic-error ()
(let ((x 1))
(error "MEH")))
(defvar nic-args nil)
(flet ((debug (&rest args)
(setq nic-args args)))
(condition-case err
(nic-error)
((debug error) "blah")))
It seems a bit odd having to specify the debugger to capture the
backtrace.
I guess I could make a new condition-case like macro that did this
routinely.
Wouldn't it be better to just grab the backtrace whenever an error
occurs and put it in a global or push it on to a global list?
Nic