tweak(cli): improve backtrace formatting
This commit is contained in:
parent
3854c2fd70
commit
432ca05c4f
1 changed files with 8 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
(cl-defun doom-cli--debugger (error data)
|
(cl-defun doom-cli--debugger (error data)
|
||||||
(cl-incf num-nonmacro-input-events)
|
(cl-incf num-nonmacro-input-events)
|
||||||
(cl-destructuring-bind (backtrace &optional type data . _)
|
(cl-destructuring-bind (backtrace &optional type data . rest)
|
||||||
(cons (doom-cli--backtrace) data)
|
(cons (doom-cli--backtrace) data)
|
||||||
(with-output-to! doom--cli-log-buffer
|
(with-output-to! doom--cli-log-buffer
|
||||||
(let ((straight-error
|
(let ((straight-error
|
||||||
|
@ -25,15 +25,17 @@
|
||||||
((print! (error "There was an unexpected error"))
|
((print! (error "There was an unexpected error"))
|
||||||
(print-group!
|
(print-group!
|
||||||
(print! "%s %s" (bold "Message:") (get type 'error-message))
|
(print! "%s %s" (bold "Message:") (get type 'error-message))
|
||||||
(print! "%s %S" (bold "Data:") (cons type data))
|
(print! "%s %S" (bold "Error:") (append (list type data) rest))
|
||||||
(when backtrace
|
(when backtrace
|
||||||
(print! (bold "Backtrace:"))
|
(print! (bold "Backtrace:"))
|
||||||
(print-group!
|
(print-group!
|
||||||
(dolist (frame (seq-take backtrace 10))
|
(dolist (frame (seq-take backtrace 10))
|
||||||
(print!
|
(let* ((frame (replace-regexp-in-string
|
||||||
"%0.74s" (replace-regexp-in-string
|
"[\n\r]" "\\\\n" (prin1-to-string frame)))
|
||||||
"[\n\r]" "\\\\n"
|
(frame (if (> (length frame) 74)
|
||||||
(format "%S" frame)))))))))
|
(concat (substring frame 0 74) "...")
|
||||||
|
frame)))
|
||||||
|
(print! "%s" frame))))))))
|
||||||
(when backtrace
|
(when backtrace
|
||||||
(with-temp-file doom-cli-log-error-file
|
(with-temp-file doom-cli-log-error-file
|
||||||
(insert "# -*- lisp-interaction -*-\n")
|
(insert "# -*- lisp-interaction -*-\n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue