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
aa9ca8fc
Unverified
Commit
aa9ca8fc
authored
Aug 05, 2019
by
Danny Tuppeny
Committed by
GitHub
Aug 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure user-thrown errors have ErrorSummary nodes (#36857)
parent
7c27142e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+1
-1
assertions_test.dart
packages/flutter/test/foundation/assertions_test.dart
+24
-0
No files found.
packages/flutter/lib/src/foundation/assertions.dart
View file @
aa9ca8fc
...
...
@@ -411,7 +411,7 @@ class FlutterErrorDetails extends Diagnosticable {
String
message
=
exceptionAsString
();
if
(
message
.
startsWith
(
prefix
))
message
=
message
.
substring
(
prefix
.
length
);
properties
.
add
(
Error
Description
(
'
$message
'
));
properties
.
add
(
Error
Summary
(
'
$message
'
));
}
}
...
...
packages/flutter/test/foundation/assertions_test.dart
View file @
aa9ca8fc
...
...
@@ -328,4 +328,28 @@ void main() {
);
}
});
test
(
'User-thrown exceptions have ErrorSummary properties'
,
()
{
{
DiagnosticsNode
node
;
try
{
throw
'User thrown string'
;
}
catch
(
e
)
{
node
=
FlutterErrorDetails
(
exception:
e
).
toDiagnosticsNode
();
}
final
ErrorSummary
summary
=
node
.
getProperties
().
whereType
<
ErrorSummary
>().
single
;
expect
(
summary
.
value
,
equals
(<
String
>[
'User thrown string'
]));
}
{
DiagnosticsNode
node
;
try
{
throw
ArgumentError
.
notNull
(
'myArgument'
);
}
catch
(
e
)
{
node
=
FlutterErrorDetails
(
exception:
e
).
toDiagnosticsNode
();
}
final
ErrorSummary
summary
=
node
.
getProperties
().
whereType
<
ErrorSummary
>().
single
;
expect
(
summary
.
value
,
equals
(<
String
>[
'Invalid argument(s) (myArgument): Must not be null'
]));
}
});
}
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