-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve enum fromOrdinal and valueOf error messages #19178
Comments
sure we can change the message but is looking at the stack trace no good? |
Sure the stack trace helps, but why make it harder, specially for newbies? This way you just look at the error message and you get all the information you need. The message could be even more helpful stating the possible expected values. |
You could "split the difference" and
I guess the full name is usefuller. Listing elements could be very verbose. |
Pretty sure this does not make sense since these are runtime errors, but is it possible to show the elements based on some compiler verbose flag? |
In the discussion over whether case class toString can be made verbose, I proposed a compiler flag to enable it, with the idea that during development you want more verbose output always. That is an easier sell if the compiler had a native notion of dev vs prod target. Flag fiddling at the build tool level is more fraught. |
Compiler version
3.3.1
Minimized example
Output Error/Warning message
fromOrdinal
valueOf
Why this Error/Warning was not helpful
It does not state from which enum the error has originated, making it harder to track it down.
Suggested improvement
fromOrdinal:
valueOf
The text was updated successfully, but these errors were encountered: