-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Use native Error instead of custom Error subclass. #17216
Conversation
da88c32
to
a5fb2f3
Compare
This maybe considered a breaking change if people are using instanceof to conditionally check |
Please note that just because a given change might be observable, does not mean that it actually is breaking... The thing that you are concerned with is where you were trying to see if a caught error was an I just don't think this is a valid "thing to do" or care about. I also cannot find code on emberobserver.com codesearch that would fail with this change:
Out of all of the cases I reviewed (including |
I added @stefanpenner as a reviewer also, I know he has had thoughts on this in the past... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please! 🙏
^^ Is my only concern. I think @rwjblue approach to investigating risk here is quite good though, so I would like to see if we can proceed. Thoughts on:
In general, I am more inclined to rip the bandaid off if possible, be we should be cognizant of any fallout. I believe your diligence is approaching sufficient, at-least for me. |
@rwjblue I think this might be worth a short RFC, if just to document the tradeoffs and decision-making that went into it. If you don't have bandwidth for it, I bet we could find someone in the community to help us write it up. |
@tomdale - I disagree. This doesn't add a deprecation, add new public APIs, or change existing public APIs in a way that apps/addons will be affected. |
@rwjblue Fair enough — forgive me for not adequately reading your analysis above about looking for (and not finding) any examples of code that would break in the wild. My concern is companies that may have custom instrumentation that integrates with proprietary error reporting infrastructure. Examples of that may be hard to track down as they are unlikely to be open source. In this case, Without litigating whether If you don't think an RFC is appropriate, would you be open to making sure we include a mention of it in the release notes/blog post? |
if @tomdale is good with it, I believe explicit callout of the change (and potential risk) is sufficient to move forward. |
@stefanpenner Sounds good to me. 👍 |
a5fb2f3
to
407ea95
Compare
Thanks for working through this y'all. I've just rebased, and will coordinate with @kategengler on the CHANGELOG entry. |
Was there a mention of this in a blog post as talked about above? It caught us out with |
The advantage of ember's own Error class is it's easier to extend with babel transpilation, especially babel6. Otherwise, users need some custom hack to make the extending work with See details on MDN and StackOverflow. |
@xg-wang Was that a reply to me? It's not what I asked that's all. |
@amk221 I haven't done any tests, I just ran into the MDN doc and have concerns about changes in this PR. But based on the babel issue described I think your issue about |
@xg-wang My issue is that this broke our site as we didn't know about the change. (The fix was simply to not extend EmberError) |
@amk221 yes it has issue with |
@xg-wang Babel 7 seems to work quite well with it, as long as it is able to detect that you're extending the native |
We originally created a custom subclass of
Error
because we speculatively might want to be able to discern "Ember error" from "non-Ember errors". Over the years, this custom Error subclass has caused us a significant amount of pain and I do not think that we have actually leveraged the "custom error subclass" concept much at all. This removes the custom subclass and replaces it withError
...