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

Better error handling #4

Open
DawidWetzler opened this issue Oct 23, 2023 · 0 comments
Open

Better error handling #4

DawidWetzler opened this issue Oct 23, 2023 · 0 comments

Comments

@DawidWetzler
Copy link

Hello there,

during the hands-on work in today's workshop I came across a question regarding the possibility to change the error messages of the decorators.

Why?

  • messages can be translated
  • error messages can be displayed directly
  • no extra handling within methods (e.g. try catch)

Imagine following scenario
@attr(number({min: 0, max: 5}), {reflective: false}) accessor value = 0;

Whenever value becomes > 5 it produces always the same exception:

RangeError: 6 is out of range [0, 5]

That's fine, but... it would be much better to have a way to set your own messages and/or to be able to treat them individually.

Example:

Number can't be higher than 5
Number can't be lower than 0

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