Skip to content

ApiProblem.name is read only :( #1

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

Open
peritus opened this issue Jan 15, 2017 · 0 comments
Open

ApiProblem.name is read only :( #1

peritus opened this issue Jan 15, 2017 · 0 comments

Comments

@peritus
Copy link

peritus commented Jan 15, 2017

Hey,

I'm using ApiProblem.create() to create custom API problems. I then (among other things) send them to @getsentry for further internal error reporting.

To not have all errors that are the result of an ApiProblem to be grouped under "HTTP-Problem", I tried to set the .name property, however I get

TypeError: Cannot assign to read only property 'name' of function

mostly because of this line:

constant(this, 'name', 'HTTP-Problem', true);

Is there a specific reason for that lock-down on writable properties ?

Could name be a parameter, so that users of this lib have some influence over

HTTP-Problem: [400] my error description > https://problems.example.com/myerror12'

to say

MyCustomError: [400] my error description > https://problems.example.com/myerror12'

when stringifying ?

Or is there another way (apart from the documented new (ApiProblem.create())) to subclass ApiProblem ?

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

1 participant