Questions tagged «backtrace»

1
以编程方式从错误中获取回溯
如果在Emacs Lisp代码中以表示错误,并且debug-on-error为t,则我将获得一个回溯缓冲区,可以很容易地找出发生错误的位置。但是,对于异步处理来自网络的响应时发生的错误,弹出回溯缓冲区会很烦人,所以我宁愿捕获错误condition-case并记录下来。 因此,当我处理中的错误时condition-case,是否有办法在错误发生时访问回溯?调用该backtrace函数将获取处理程序内部代码的回溯,这不是我想要的。 (condition-case e (do-something-that-might-fail) (error (message "%s" ;; This gets the wrong backtrace! (with-temp-buffer (let ((standard-output (current-buffer))) (backtrace) (buffer-string))))))
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.