Skip to content
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

Handle addon constructor errors gracefully #6886

Merged
merged 1 commit into from Mar 23, 2017
Merged

Conversation

jsturgis
Copy link
Contributor

This change adds a user friendly error message when an addon constructor
function throws an error during addon initialization.

Fixes #6820

This change adds a user friendly error message when an addon constructor
function throws an error during addon initialization.
@rwjblue
Copy link
Member

rwjblue commented Mar 21, 2017

Looks really good, thanks for working on this!

One thought that I had was that we may want to also wrap the Addon.lookup line as well (but keep track of which one errors). That Addon.lookup just above is where we require the actual addon module (here), so we could provide nicer errors for both scenarios:

  • An error occured in the constructor for ${addonInfo.name} at ${addonInfo.path}
  • An error occured while requiring ${addonInfo.name} at ${addonInfo.path}

What do you think?

@jsturgis
Copy link
Contributor Author

Thanks! I think that sounds like a good idea but I noticed that Addon.lookup is already handling the most common error case here and I can't think of another error case that could happen in lookup that it isn't already checking for.

@rwjblue
Copy link
Member

rwjblue commented Mar 22, 2017

Seems good, thanks for checking into it!

@homu r+

@homu
Copy link
Contributor

homu commented Mar 22, 2017

📌 Commit 1de03e3 has been approved by rwjblue

homu added a commit that referenced this pull request Mar 22, 2017
Handle addon constructor errors gracefully

This change adds a user friendly error message when an addon constructor
function throws an error during addon initialization.

Fixes #6820
@homu
Copy link
Contributor

homu commented Mar 22, 2017

⌛ Testing commit 1de03e3 with merge f2acf6e...

@homu
Copy link
Contributor

homu commented Mar 23, 2017

☀️ Test successful - status

@homu homu merged commit 1de03e3 into ember-cli:master Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants