Skip to content

Flutter driver error logger assumes stderr which breaks web #186751

Description

@jakemac53

Steps to reproduce

On the web, if you make a flutter_driver call which wants to log an error, that will end up raising an exception due to the hard coded reliance on stderr.writeln here. Note that in DDC, this throws an UnsupportedError - so we could potentially just also catch those exceptions.

DDC does not implement this API (although possibly it could via console.error or something?) cc @nshahan .

Expected results

I expect it to not cause an unhandled exception, and ideally actually log the error somewhere like console.stderr.

Actual results

It raises an exception and the request times out instead of getting a nice error.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
The following UnsupportedError was 
thrown during a service extension callback for
\"ext.flutter.driver\":
Unsupported operation: 
StdIOUtils._getStdioOutputStream

When the exception was thrown, this was the stack:
dart-sdk/
lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 274:3       throw_
dart-sdk/lib/
_internal/js_dev_runtime/patch/io_patch.dart 684:5                   _getStdioOutputStream
dart-
sdk/lib/io/stdio.dart 508:36                                                 get _stderr
dart-sdk/
lib/io/stdio.dart 543:41                                                 get 
stderr
ddc_module_loader.js 1517:25                                                      
get
package:flutter_driver/src/common/error.dart 58:5                                 
_defaultDriverLogger
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 
118:77  tear
package:flutter_driver/src/extension/extension.dart 394:5                         
[_log]
package:flutter_driver/src/extension/extension.dart 432:9                         
<fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 618:19               <fn>
dart-
sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 643:23               <fn>
dart-sdk/lib/
_internal/js_dev_runtime/patch/async_patch.dart 593:5                <fn>
dart-sdk/lib/async/
zone.dart 967:54                                               runBinary
dart-sdk/lib/async/
future_impl.dart 237:22                                        handleError
dart-sdk/lib/async/
future_impl.dart 960:46                                        handleError
dart-sdk/lib/async/
future_impl.dart 981:13                                        _propagateToListeners
dart-sdk/lib/
async/future_impl.dart 738:5                                         [_completeErrorObject]
dart-
sdk/lib/async/future_impl.dart 742:5                                         
[_completeError]
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 506:7               
 completeError
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 577:12               
_asyncRethrow
package:flutter_driver/src/common/handler_factory.dart 239:18                     
<fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 618:19               <fn>
dart-
sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 643:23               <fn>
dart-sdk/lib/
_internal/js_dev_runtime/patch/async_patch.dart 589:19               <fn>
dart-sdk/lib/async/
zone.dart 962:54                                               runUnary
dart-sdk/lib/async/
future_impl.dart 222:18                                        handleValue
dart-sdk/lib/async/
future_impl.dart 948:44                                        handleValueCallback
dart-sdk/lib/
async/future_impl.dart 977:13                                        _propagateToListeners
dart-
sdk/lib/async/future_impl.dart 720:5                                         
[_completeWithValue]
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 499:7           
     complete
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 566:12               
_asyncReturn
package:flutter_driver/src/common/handler_factory.dart 517:3                      
<fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 618:19               <fn>
dart-
sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 643:23               <fn>
dart-sdk/lib/
_internal/js_dev_runtime/patch/async_patch.dart 589:19               <fn>
dart-sdk/lib/async/
zone.dart 962:54                                               runUnary
dart-sdk/lib/async/
future_impl.dart 222:18                                        handleValue
dart-sdk/lib/async/
future_impl.dart 948:44                                        handleValueCallback
dart-sdk/lib/
async/future_impl.dart 977:13                                        _propagateToListeners
dart-
sdk/lib/async/future_impl.dart 720:5                                         
[_completeWithValue]
dart-sdk/lib/async/future_impl.dart 804:7                                    
     <fn>
dart-sdk/lib/async/schedule_microtask.dart 40:34                                  
_microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                                   
_startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 
118:77  tear
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 183:69               
<fn>
═════════════════════════════════════════════════════════════════════════════════════════════
═══════

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listplatform-webWeb applications specificallyteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions