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

@ -27,10 +27,6 @@ A warning will be put out if these deprecated modules are used.")
;; Bootstrap API
;;
;; Custom errors
(define-error 'doom-autoload-error "Error in your autoloads file(s)" 'doom-error)
(define-error 'doom-private-error "Error in your private config" 'doom-error)
(defun doom-initialize-modules (&optional force-p)
"Loads the init.el in `doom-private-dir' and sets up hooks for a healthy
session of Dooming. Will noop if used more than once, unless FORCE-P is
@ -43,8 +39,8 @@ non-nil."
(condition-case e
(load (expand-file-name "init" doom-private-dir)
'noerror 'nomessage)
((debug error)
(signal 'doom-private-error (list 'init e)))))))
((debug doom-error) (signal (car e) (cdr e)))
((debug error) (signal 'doom-private-error (list "init.el" e)))))))
;;
@ -285,11 +281,7 @@ to least)."
(let ((doom--stage 'config))
,@(nreverse config-forms)
(when doom-private-dir
(condition-case e
(load ,(expand-file-name "config" doom-private-dir)
t (not doom-debug-mode))
((debug error)
(signal 'doom-private-error (list 'config e))))))))))
(load! "config" doom-private-dir)))))))
(defvar doom-disabled-packages)
(defmacro def-package! (name &rest plist)