Unverified Commit a48446f9 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Fix error handling for errors with empty stack traces (#62224)

Fixes https://github.com/flutter/flutter/issues/62223
parent 6e252772
......@@ -86,6 +86,7 @@ class StackFrame {
return stack
.trim()
.split('\n')
.where((String line) => line.isNotEmpty)
.map(fromStackTraceLine)
// On the Web in non-debug builds the stack trace includes the exception
// message that precedes the stack trace itself. fromStackTraceLine will
......
......@@ -201,4 +201,23 @@ Future<void> main() async {
console.clear();
FlutterError.resetErrorCount();
});
// Regression test for https://github.com/flutter/flutter/issues/62223
test('Error reporting - empty stack', () async {
expect(console, isEmpty);
FlutterError.dumpErrorToConsole(FlutterErrorDetails(
exception: 'exception - empty stack',
stack: StackTrace.fromString(''),
));
expect(console.join('\n'), matches(
r'^══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════\n'
r'The following message was thrown:\n'
r'exception - empty stack\n'
r'\n'
r'When the exception was thrown, this was the stack:\n'
r'...\n'
r'════════════════════════════════════════════════════════════════════════════════════════════════════$',
));
console.clear();
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment