cli: clarify post-error debug mode instructions

This commit is contained in:
Henrik Lissner 2019-12-08 00:56:11 -05:00
parent 33b78499fc
commit ecb76d536b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -69,7 +69,6 @@ with a different private module."
((condition-case e ((condition-case e
(let ((start-time (current-time))) (let ((start-time (current-time)))
(and (doom-cli-execute command args) (and (doom-cli-execute command args)
(terpri)
(print! (success "Finished! (%.4fs)") (print! (success "Finished! (%.4fs)")
(float-time (float-time
(time-subtract (current-time) (time-subtract (current-time)
@ -78,20 +77,30 @@ with a different private module."
(print! (error "%s\n") (error-message-string e)) (print! (error "%s\n") (error-message-string e))
(print! (yellow "See 'doom help %s' for documentation on this command.") (car args))) (print! (yellow "See 'doom help %s' for documentation on this command.") (car args)))
((debug error) ((debug error)
(message "--------------------------------------------------\n") (print! (error "There was an unexpected error:"))
(message "There was an unexpected error:") (print-group!
(message " %s (%s)" (get (car e) 'error-message) (car e)) (print! "%s %s" (bold "Type:") (car e))
(dolist (item (cdr e)) (print! (bold "Message:"))
(message " %s" item)) (print-group!
(print! "%s" (get (car e) 'error-message)))
(print! (bold "Data:"))
(print-group!
(if (cdr e)
(dolist (item (cdr e))
(print! "%S" item))
(print! "n/a"))))
(unless debug-on-error (unless debug-on-error
(message (terpri)
(concat "\nRun the command again with the -d (or --debug) option to enable debug\n" (print!
"mode and, hopefully, generate a stack trace. If you decide to file a bug\n" (concat "Run the command again with the -d (or --debug) switch to enable debug\n"
"report, please include it!\n\n" "mode and (hopefully) generate a backtrace from this error:\n"
"Emacs outputs to standard error, so you'll need to redirect stderr to\n" "\n %s\n\n"
"stdout to pipe this to a file or clipboard!\n\n" "If you file a bug report, please include it!")
" e.g. doom -d install 2>&1 | clipboard-program\n")) (string-join (append (list (file-name-nondirectory load-file-name) "-d" command)
(signal 'doom-error e))))))) args)
" "))
;; Ensure the process returns non-zero
(error "")))))))
(doom-cli-execute :main (cdr (member "--" argv))) (doom-cli-execute :main (cdr (member "--" argv)))
(setq argv nil)) (setq argv nil))