-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add a BuildFailure class, and catch in the runners #981
Comments
Some other options for completeness:
|
I personally like
|
@jakemac53 any thoughts here? |
+1 I am in favor, we should also automagically wrap any normal exceptions from builders in one of these |
I'm considering trying this before #2624, but it's unclear to me where such errors should be handled in
|
https://github.com/dart-lang/build/blob/master/build_runner_core/lib/src/generate/build_impl.dart#L486 is roughly where the builder actually gets ran - that is calling this api from |
Builders are invoked here:
I would expect that special handling for this exception might involve the logging handler: build/build/lib/src/builder/logging.dart Line 28 in 04ba219
|
Great, thanks for the help! One last quick question before I get started. The proposal suggests an |
Yes. This should be an exception. I would implement that interface but not include it in the name |
@natebosch Is this effectively done now? Looks like the stack trace is only printed in verbose mode: build/build_runner/lib/src/logging/std_io_logging.dart Lines 36 to 42 in feceaa4
|
Yeah I think so. We could consider having an even more suppressed stack trace for this exception type specifically, but I don't know that it is necessary. |
In that case, what differentiates an exception that is specifically a |
We'd have to do something like It's entirely possible that we don't even need to define One benefit of having a single type that everyone agrees means "this isn't a bug, the build is bad" is that if builder authors do want to do some munging of exceptions they could use a pattern like: try {
await doBuilderWork();
} on BuildFailure {
rethrow;
} catch (e, st) {
throw MyBuilderHasABug(); // nice error message about filing a bug
} |
We should not display the stack trace (or do it as
FINE
) for these type of errors./cc @natebosch
build
build_runner
bazel_codegen
(Add BuildError support dart-archive/bazel#212)The text was updated successfully, but these errors were encountered: