-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[core] Catch errors in package init functions and when loading files #16952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 3 commits
af7981f
e36fe6c
e1bc953
dc8c133
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -423,7 +423,7 @@ cache folder.") | |
|
|
||
| (defun configuration-layer/load-lock-file () | ||
| "Load the .lock file" | ||
| (configuration-layer/load-file configuration-layer-lock-file)) | ||
| (load configuration-layer-lock-file nil (not init-file-debug))) | ||
|
|
||
| (defun configuration-layer/initialize () | ||
| "Initialize `package.el'." | ||
|
|
@@ -1574,10 +1574,10 @@ RNAME is the name symbol of another existing layer." | |
| (set-default var val)) | ||
| ('error | ||
| (configuration-layer//error | ||
| (concat "\nAn error occurred while setting layer " | ||
| (concat "An error occurred while setting layer " | ||
| "variable %s " | ||
| "(error: %s). Be sure to quote the value " | ||
| "if needed.\n") var err))) | ||
| "if needed.") var err))) | ||
| (configuration-layer//warning "Missing value for variable %s !" | ||
| var)))))) | ||
|
|
||
|
|
@@ -1691,7 +1691,7 @@ RNAME is the name symbol of another existing layer." | |
| pkg-name))) | ||
| ('error | ||
| (configuration-layer//error | ||
| (concat "\nAn error occurred while installing %s " "(error: %s)\n") | ||
| (concat "An error occurred while installing %s " "(error: %s)") | ||
| pkg-name | ||
| err) | ||
| (spacemacs//redisplay)))))) | ||
|
|
@@ -2006,8 +2006,8 @@ LAYER must not be the owner of PKG." | |
| (funcall (intern (format "%S/pre-init-%S" layer pkg-name))) | ||
| ('error | ||
| (configuration-layer//error | ||
| (concat "\nAn error occurred while pre-configuring %S " | ||
| "in layer %S (error: %s)\n") | ||
| (concat "An error occurred while pre-configuring %S " | ||
| "in layer %S (error: %s)") | ||
| pkg-name layer err)))))) | ||
| (oref pkg :pre-layers)))) | ||
|
|
||
|
|
@@ -2018,7 +2018,13 @@ LAYER must not be the owner of PKG." | |
| (owner (car (oref pkg :owners)))) | ||
| ;; init | ||
| (spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner)) | ||
| (funcall (intern (format "%S/init-%S" owner pkg-name))))) | ||
| (condition-case-unless-debug err | ||
| (funcall (intern (format "%S/init-%S" owner pkg-name))) | ||
| ('error | ||
| (configuration-layer//error | ||
| (concat "An error occurred while configuring %S " | ||
| "in layer %S (error: %s)") | ||
| pkg-name owner err))))) | ||
|
|
||
| (defun configuration-layer//post-configure-package (pkg) | ||
| "Post-configure PKG object, i.e. call its post-init functions." | ||
|
|
@@ -2035,8 +2041,8 @@ LAYER must not be the owner of PKG." | |
| (funcall (intern (format "%S/post-init-%S" layer pkg-name))) | ||
| ('error | ||
| (configuration-layer//error | ||
| (concat "\nAn error occurred while post-configuring %S " | ||
| "in layer %S (error: %s)\n") | ||
| (concat "An error occurred while post-configuring %S " | ||
| "in layer %S (error: %s)") | ||
| pkg-name layer err)))))) | ||
| (oref pkg :post-layers)))) | ||
|
|
||
|
|
@@ -2800,7 +2806,12 @@ ARGS: format string arguments." | |
|
|
||
| (defun configuration-layer/load-file (file &optional noerror) | ||
| "Load file silently except if in debug mode." | ||
| (load file noerror (not init-file-debug))) | ||
| (condition-case-unless-debug err | ||
| (load file noerror (not init-file-debug)) | ||
| ('error | ||
| (configuration-layer//error | ||
| "An error occurred while loading %S (error: %s)" | ||
| file err)))) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced this change is a good idea. It is also unfortunately a "public" function based on naming convention, so one more reason to maybe change the callsites rather than the function itself (although I consider this a weaker reason).
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In In |
||
|
|
||
| (provide 'core-configuration-layer) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.