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

Hard to subclass with ES6 class syntax #10

Open
mathew-kurian opened this issue Mar 19, 2016 · 4 comments
Open

Hard to subclass with ES6 class syntax #10

mathew-kurian opened this issue Mar 19, 2016 · 4 comments

Comments

@mathew-kurian
Copy link

I not 100% sure I don't think this class meets the class es6 specifications because you are overriding the stack attribute which makes it hard to extend and modify the stack property via class inheritance offered in ES6. I had recently made a library https://github.com/bluejamesbond/TraceError.js. If you think, this offers a potential benefits, I would happy to provide a pull request into your library.

@mathew-kurian mathew-kurian changed the title ES6 compliance and extending error ES6 compliance and inheritance Mar 19, 2016
@mdlavin
Copy link
Owner

mdlavin commented Mar 21, 2016

I can see the advantages of the approach you took. If you want to submit a PR I'd be happy to merge it. If not, I might look at making that change myself. Thanks for the idea.

@mathew-kurian
Copy link
Author

I feel that we are both trying to solve the same problem here. Would you like to merge the two libraries together to simplify maintainability? At the moment, I have support for node >= 0.11. It is not tested for browsers; however, from the logic it can support those that have setPrototypeOf, getPrototTypeOf, defineProperty, and getOwnPropertyDescriptors (or at least polly-filled).

@mdlavin
Copy link
Owner

mdlavin commented Mar 23, 2016

I'm always up for improvements. It looks like https://github.com/bluejamesbond/TraceError.js is just starting out, if you put the time into improving this project it will have a wide impact right away with the existing dependent projects.

You point out good improvement for ES6 support and subclassing, but people are already using this project with a range of node versions 0.10 through 4 at least. I know my projects use node 4.4 and I know of at least a couple of others who are too. Perhaps most people don't want to subclass and also extend the stack property?

@mathew-kurian
Copy link
Author

I understand. The stack extension generally allows multiple layers of transpilers which allows different forms of stacktraces to be mapped to the source especially with the advent of ES6 and Babel/TypeScript/JSX. That being said, this library is not yet being supported in 0.10 which is definitely an incompatibility. Additionally, if you see any issues with the library atm let me know; I would be happy to address it.

@mdlavin mdlavin changed the title ES6 compliance and inheritance Hard to subclass with ES6 class syntax Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants