Comments (6)
The new
Iterable<Future>.wait
andRecord<Future, ...>.wait
extensions are really great, particularly records allowing you to maintain type safety when waiting to resolve different types at once.
I haven't heard of these before, but they indeed seem very useful!
They can't be used inside the tool's implementation though, as the tool's error handling doesn't account for the
ParallelWaitError
awaiting them can throw.
Could you expand on this? What is the expected behavior here, and what is the actual behavior you see?
from flutter.
Could you expand on this? What is the expected behavior here, and what is the actual behavior you see?
Sorry for not being too specific. When running a supplied command the tool has error handling to surface any underlying errors and adapt to them differently, for example ToolExit
not resulting in a crash report.
If the ToolExit
results from a await (functionThatThrowsToolExit(), functionThatThrowsToolExit()).wait)
, the command runner will only see the ParallelWaitError
that wraps it and pass that on to the user (and potentially crash reporter?).
from flutter.
Ah okay, I understand now. Thanks!
I think it makes sense to augment _handleToolError
to handle ParallelWaitError
s. It's not obvious how exactly this should work since the errors
list could contain any combination of ToolExit
s and non-ToolExit
s. Specifically, there are a few cases to handle:
- cases where all of the error(s) are
ToolExit
s, - cases where all of the errors(s) are not
ToolExit
s, and - cases where there is some combination of
ToolExit
s and non-ToolExit
s.
Case 1 is mostly a matter of figuring out what we should display to the user, which shouldn't be terribly hard.
For case 2, I think we can just let the ParallelWaitError
fall through. The stack trace would be that of the first error1, which would be enough information to triage the crash. The downside here is that the first error would effectively hide the rest of the errors. However, I don't think this would be a serious problem unless multiple non-ToolExit
errors always occur together. What's more likely (in this already unlikely scenario) is that this would just result in some errors being under-reported, which I think is acceptable.
Case 3 is probably the most tricky. We can't rely on the default behavior of ParallelWaitError::stackTrace
because that stack trace could be from a ToolExit
, which shouldn't be the one that gets included in the crash report. One idea would be to simply throw
the first non-ToolExit
.
Alternatively, for cases 2 and 3, we could send crash reports for each non-ToolExit
and then use only the first error for creating a crash log and the link that we display to the user. This way we don't risk one error hiding other ones.
These are just some ideas. I'd be happy to discuss and think about this further in any PR that's created to resolve this issue.
Footnotes
-
https://dart-review.googlesource.com/c/sdk/+/353080. I believe the error's message will include the message from exactly one of the underlying errors, but I am not sure if it's always the first error. Example error message from some local hacking:
ParallelWaitError<List<num?>, List<AsyncError?>>: ParallelWaitError: Null check operator used on a null value
↩
from flutter.
FWIW, if we were using
Future.wait
before, we were already not handling the cases above.That is, we certainly should not crash the tool, but I think we could just show the first
ToolExit
(if any), and if not, show all of the errors. We could do better than that, but it would be a strict improvement overFuture.wait
and not feature parity.
Future.wait
has different semantics, where I believe it will eagerly complete with the FIRST error, whereas (futureA, futureB).wait
would collect all errors and then wrap them in a new type, ParallelWaitError
.
from flutter.
FWIW, if we were using Future.wait
before, we were already not handling the cases above.
That is, we certainly should not crash the tool, but I think we could just show the first ToolExit
(if any), and if not, show all of the errors. We could do better than that, but it would be a strict improvement over Future.wait
and not feature parity.
from flutter.
IIRC it only eagerly completes if eager: true
is set, right? Otherwise it just happens to not show the other errors.
from flutter.
Related Issues (20)
- `default_package` references now create an error if they reference a package that isn't a plugin implementation HOT 5
- [tool] Notify app developers of plugins that are incompatible with Swift Package Manager
- win-16 is low on disk space for local Temp directory. HOT 2
- `DropdownMenu.onSelected` conflicts with `TextField` `onTapOutside` when `requestFocusOnTap: false` and `true` HOT 1
- win-17 is low on disk space for local Temp directory. HOT 2
- win-8 is low on disk space for local Temp directory. HOT 2
- [Impeller] Shader issue on scroll HOT 3
- [CP] [web] Set touch-action:none in embedded views. HOT 9
- [CP] Make `CupertinoRadio`'s `mouseCursor` a `WidgetStateProperty` HOT 2
- [Memory leak][iOS] PlatformView with UIImageView & Scrolling get junk on showModalBottomSheet HOT 13
- [DropdownMenu]: With `enableFilter` and `initialSelection` set as `true`, only the pre-selected option is available. HOT 5
- [go_router] Query parameter lost after click on back button in android HOT 3
- Rtl numbers problem when running flutter web on chrome in samsung phones HOT 3
- [ERROR:flutter/lib/ui/painting/image_encoding.cc(215)] Could not convert raster image to PNG. HOT 2
- Expose `MaterialPageRoute` `ZoomEnterTransition` scrim color
- [windows] The windows app is random freezing in Windows 11 HOT 9
- Suggest: TextEditingController's buildTextSpan({required BuildContext context, TextStyle? style , required bool withComposing}) return InlineSpan HOT 6
- Consider changing alignmentPolicy in focus traversal
- Lexical or Preprocessor Issue HOT 3
- [tool_crash] SocketException: Send failed, OS Error: No route to host, errno = 65 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.