-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[getContrastText] Throw descriptive exception when passing falsy argument #18383
[getContrastText] Throw descriptive exception when passing falsy argument #18383
Conversation
Details of bundle changes.Comparing: 384d61a...636b203
|
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.
I wasn't able in the past to communicate why throwing is better than logging. I hope it is clearer now when and why this is better. |
@eps1lon I wouldn't mind if we wrap it with a |
Definitely. I did some experiments a few months ago but the savings were very small compared to the build complexity. I was kind of hoping someone would build a babel plugin for it 😄 |
The problem with
console.error
is that it is oftentimes overlooked. When we know that an exception will be thrown if we continue we might as well throw ourselves with the benefit of: