Redesign Doom error handling

Another refactor, again to improve the locality of doom errors and make
the data that accompanies them more useful in determining the origin and
source of issues. Also, bin/doom is now a little more informative about
how to debug errors.
This commit is contained in:
Henrik Lissner 2018-06-20 02:07:12 +02:00
parent 84756b33a0
commit 151858a8dc
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 89 additions and 64 deletions

View file

@ -85,5 +85,18 @@
((let ((default-directory emacs-dir))
(setq argv nil
noninteractive 'doom)
(doom-dispatch args)))))
(condition-case e (doom-dispatch args)
((debug error)
(message "--------------------------------------------------\n")
(message "There was an unexpected error:")
(message " %s (%s)" (get (car e) 'error-message) (car e))
(dolist (item (cdr e))
(message " %s" item))
(unless debug-on-error
(message
(concat "\nRun the command again with the -d (or --debug) option to enable debug\n"
"mode and, hopefully, generate a stack trace. If you decide to file a bug\n"
"report, please include it!\n\n"
"Emacs outputs to standard error, so you'll need to redirect stderr to\n"
"stdout to pipe this to a file or clipboard!\n\n"
" e.g. doom -d install 2>&1 | clipboard-program")))))))))