Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f33e88ce
Unverified
Commit
f33e88ce
authored
May 21, 2021
by
Andre
Committed by
GitHub
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent DiagnosticsStackTrace truncation (#82140)
parent
90d0443b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+3
-0
error_reporting_test.dart
packages/flutter/test/foundation/error_reporting_test.dart
+41
-2
No files found.
packages/flutter/lib/src/foundation/assertions.dart
View file @
f33e88ce
...
...
@@ -1218,6 +1218,9 @@ class DiagnosticsStackTrace extends DiagnosticsBlock {
static
DiagnosticsNode
_createStackFrame
(
String
frame
)
{
return
DiagnosticsNode
.
message
(
frame
,
allowWrap:
false
);
}
@override
bool
get
allowTruncate
=>
false
;
}
class
_FlutterErrorDetailsNode
extends
DiagnosticableNode
<
FlutterErrorDetails
>
{
...
...
packages/flutter/test/foundation/error_reporting_test.dart
View file @
f33e88ce
...
...
@@ -213,10 +213,49 @@ Future<void> main() async {
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'When the exception was thrown, this was the stack\n'
r'════════════════════════════════════════════════════════════════════════════════════════════════════$'
,
));
console
.
clear
();
FlutterError
.
resetErrorCount
();
});
test
(
'Stack traces are not truncated'
,
()
async
{
const
String
stackString
=
'''
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
#2 new Text (package:flutter/src/widgets/text.dart:287:10)
#3 _MyHomePageState.build (package:hello_flutter/main.dart:72:16)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4414:27)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4303:15)
#6 Element.rebuild (package:flutter/src/widgets/framework.dart:4027:5)
#7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4286:5)
#8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4461:11)
#9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4281:5)
#10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3276:14)'''
;
expect
(
console
,
isEmpty
);
FlutterError
.
dumpErrorToConsole
(
FlutterErrorDetails
(
exception:
AssertionError
(
'Test assertion'
),
stack:
StackTrace
.
fromString
(
stackString
),
));
final
String
x
=
console
.
join
(
'
\n
'
);
expect
(
x
,
startsWith
(
'''
══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
The following assertion was thrown:
Assertion failed: "Test assertion"
When the exception was thrown, this was the stack:
#2 new Text (package:flutter/src/widgets/text.dart:287:10)
#3 _MyHomePageState.build (package:hello_flutter/main.dart:72:16)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4414:27)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4303:15)
#6 Element.rebuild (package:flutter/src/widgets/framework.dart:4027:5)
#7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4286:5)
#8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4461:11)
#9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4281:5)'''
,
));
console
.
clear
();
FlutterError
.
resetErrorCount
();
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment