-
Notifications
You must be signed in to change notification settings - Fork 33
Drop webpack, modernize build system #204
Copy link
Copy link
Open
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps updif:hardHaving worked on the specific codebase is importantHaving worked on the specific codebase is importantkind:maintenanceWork required to avoid breaking changes or harm to project's status quoWork required to avoid breaking changes or harm to project's status quotype:issue
Metadata
Metadata
Assignees
Labels
P1High: Likely tackled by core team if no one steps upHigh: Likely tackled by core team if no one steps updif:hardHaving worked on the specific codebase is importantHaving worked on the specific codebase is importantkind:maintenanceWork required to avoid breaking changes or harm to project's status quoWork required to avoid breaking changes or harm to project's status quotype:issue
I have discovered that thanks to Babel's limitations we can't extend the built-in
Errorclass for our custom error class as it is not possible to useinstanceofassertion on it afterward.The solution is using the error codes that I have already proposed. The potential problem from the user-side is that users might expect the
instanceofcheck working so we should prevent that as only documentation might not be sufficient for that.An idea that came up to my mind is that we could not export the custom Error classes but only the error codes they represent and so "force" the users to really use code assertions instead of
instanceofassertions.UPDATE:
The original problem was most probably caused by a combination of a bug and some other weird behavior. The mentioned caveats should not be applicable to us, because this problem raises when the build target is
ES5but we are targetingES6, but...There is a new problem with assertions of Errors raised by NodeJS modules. They wrap all errors (even the native ones like
TypeError, if interested see here) in order to support error codes and possibly other stuff. Most probably thanks to Babel/Webpack some of this wrapping is broken and simplee instanceof TypeErrorforTypeErrors thrown by NodeJS module won't work.I have tested the same in browsers (I am concerned with
URLclass that is present both in Node and browser) and that works as expected.