Fix error handling for errors with empty stack traces (#62224)
Fixes https://github.com/flutter/flutter/issues/62223
This commit is contained in:
parent
6e252772d1
commit
a48446f94b
@ -86,6 +86,7 @@ class StackFrame {
|
|||||||
return stack
|
return stack
|
||||||
.trim()
|
.trim()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
.where((String line) => line.isNotEmpty)
|
||||||
.map(fromStackTraceLine)
|
.map(fromStackTraceLine)
|
||||||
// On the Web in non-debug builds the stack trace includes the exception
|
// On the Web in non-debug builds the stack trace includes the exception
|
||||||
// message that precedes the stack trace itself. fromStackTraceLine will
|
// message that precedes the stack trace itself. fromStackTraceLine will
|
||||||
|
@ -201,4 +201,23 @@ Future<void> main() async {
|
|||||||
console.clear();
|
console.clear();
|
||||||
FlutterError.resetErrorCount();
|
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();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user