-
Notifications
You must be signed in to change notification settings - Fork 106
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
Make InvalidGenerationSourceError an Exception #687
Conversation
See dart-lang/build#3585 Rename to `InvalidGenerationSource` and change to a subtype of `Exception`. This class is not thrown to indicate a programming error in the code that is running, it is thrown to indicate an error in the code under analysis. It was originally implemented without a super type and the name ending in "Error" was not specifically discussed, but it was intended to convey an "error in build input", not an error in the builder implementation (where it is thrown). Later a lint required it to be a subtype of either `Error` or `Exception`, and the `Error` supertype was chosen without discussion because of the name, even though it's not thrown as an `Error` in the sense where that distinction matters. Add a type alias for the exception with the old name. This can be deprecated whenever we have the bandwidth to handle the cleanup, but it will not be deprecated immediately. Change from `extends Error` to `implements Exception`. This is technically breaking, but it is unlikely to make a significant impact in real world usage scenarios. It may impact how the error surfaces to end users in some places.
@kevmoo - do you have concerns about the potential breakage cause by changing an |
This change did have a successful global presubmit. |
Not really? What are the failure modes here? |
The only thing I can think of is something like a builder may have an outer The context is that we are going to start showing stack traces (even without Some builders use |
Even in these cases, the worst I expect is potentially changed error reporting back to the user. It's obviously not likely to change any happy path behavior. |
See dart-lang/build#3585
Rename to
InvalidGenerationSource
and change to a subtype ofException
. This class is not thrown to indicate a programming error inthe code that is running, it is thrown to indicate an error in the code
under analysis. It was originally implemented without a super type and
the name ending in "Error" was not specifically discussed, but it was
intended to convey an "error in build input", not an error in the
builder implementation (where it is thrown). Later a lint required it to
be a subtype of either
Error
orException
, and theError
supertypewas chosen without discussion because of the name, even though it's not
thrown as an
Error
in the sense where that distinction matters.Add a type alias for the exception with the old name. This can be
deprecated whenever we have the bandwidth to handle the cleanup, but it
will not be deprecated immediately.
Change from
extends Error
toimplements Exception
. This istechnically breaking, but it is unlikely to make a significant impact in
real world usage scenarios. It may impact how the error surfaces to end
users in some places.