Fix missing doom.error.log and silent straight errors

This commit is contained in:
Henrik Lissner 2021-03-22 21:10:34 -04:00
parent ba0ddb71ee
commit 5b3f52f5fb
2 changed files with 10 additions and 11 deletions

View file

@ -5,15 +5,15 @@
(cl-destructuring-bind (backtrace &optional type data . _)
(cons (doom-cli--backtrace) data)
(with-output-to! doom--cli-log-buffer
(let ((straight-error-p
(let ((straight-error
(and (bound-and-true-p straight-process-buffer)
(stringp data)
(string-match-p (regexp-quote straight-process-buffer)
(or (get type 'error-message) "")))))
(cond (straight-error-p
(print! (error "There was an unexpected package error"))
(when-let (output (straight--process-get-output))
(print-group!
(print! "%s" (string-trim output)))))
data)
(straight--process-get-output))))
(cond (straight-error
(print! (error "The package manager threw an error"))
(print-group! (print! "%s" (string-trim straight-error))))
((print! (error "There was an unexpected error"))
(print-group!
(print! "%s %s" (bold "Message:") (get type 'error-message))
@ -30,14 +30,14 @@
(with-temp-file doom-cli-log-error-file
(insert "# -*- lisp-interaction -*-\n")
(insert "# vim: set ft=lisp:\n")
(let ((standard-output doom--cli-log-error-buffer)
(let ((standard-output (current-buffer))
(print-quoted t)
(print-escape-newlines t)
(print-escape-control-characters t)
(print-level nil)
(print-circle nil))
(when straight-error-p
(print (string-trim (or (straight--process-get-output) ""))))
(when straight-error
(print (string-trim straight-error)))
(mapc #'print (cons (list type data) backtrace)))
(print! (warn "Extended backtrace logged to %s")
(relpath doom-cli-log-error-file)))))))

View file

@ -22,7 +22,6 @@ purpose.")
"Where to write the last backtrace to.")
(defvar doom--cli-log-buffer (generate-new-buffer " *doom log*"))
(defvar doom--cli-log-error-buffer (generate-new-buffer " *doom error log*"))
(defvar doom--cli-commands (make-hash-table :test 'equal))
(defvar doom--cli-groups (make-hash-table :test 'equal))
(defvar doom--cli-group nil)