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
b5e471ee
Commit
b5e471ee
authored
Apr 15, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include the error runtimeType in the message. (#3355)
Fixes
https://github.com/flutter/flutter/issues/3352
parent
d348f28d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+24
-3
No files found.
packages/flutter/lib/src/foundation/assertions.dart
View file @
b5e471ee
...
...
@@ -20,6 +20,10 @@ class FlutterErrorDetails {
///
/// The framework calls this constructor when catching an exception that will
/// subsequently be reported using [FlutterError.onError].
///
/// The [exception] must not be null; other arguments can be left to
/// their default values. (`throw null` results in a
/// [NullThrownError] exception.)
const
FlutterErrorDetails
({
this
.
exception
,
this
.
stack
,
...
...
@@ -150,8 +154,25 @@ class FlutterError extends AssertionError {
final
String
header
=
'
\
u2550
\
u2550
\
u2561 EXCEPTION CAUGHT BY
${details.library}
\
u255E'
.
toUpperCase
();
final
String
footer
=
'
\
u2501'
*
_kWrapWidth
;
debugPrint
(
'
$header${"\u2550" * (footer.length - header.length)}
'
);
debugPrint
(
'The following exception was raised
${ details.context != null ? " ${details.context}
" : ""}:'
,
wrapWidth:
_kWrapWidth
);
debugPrint
(
'
${details.exception}
'
,
wrapWidth:
_kWrapWidth
);
final
String
verb
=
'thrown
${ details.context != null ? " ${details.context}
" : ""}'
;
if
(
details
.
exception
is
NullThrownError
)
{
debugPrint
(
'The null value was
$verb
.'
,
wrapWidth:
_kWrapWidth
);
}
else
if
(
details
.
exception
is
num
)
{
debugPrint
(
'The number
${details.exception}
was
$verb
.'
,
wrapWidth:
_kWrapWidth
);
}
else
{
String
errorName
;
if
(
details
.
exception
is
AssertionError
)
{
errorName
=
'assertion'
;
}
else
if
(
details
.
exception
is
String
)
{
errorName
=
'message'
;
}
else
if
(
details
.
exception
is
Error
||
details
.
exception
is
Exception
)
{
errorName
=
'
${details.exception.runtimeType}
'
;
}
else
{
errorName
=
'
${details.exception.runtimeType}
object'
;
}
debugPrint
(
'The following
$errorName
was
$verb
:'
,
wrapWidth:
_kWrapWidth
);
debugPrint
(
'
${details.exception}
'
,
wrapWidth:
_kWrapWidth
);
}
if
((
details
.
exception
is
AssertionError
)
&&
(
details
.
exception
is
!
FlutterError
))
{
debugPrint
(
'Either the assertion indicates an error in the framework itself, or we should '
'provide substantially more information in this error message to help you determine '
...
...
@@ -171,7 +192,7 @@ class FlutterError extends AssertionError {
debugPrint
(
footer
);
}
}
else
{
debugPrint
(
'Another exception was
raised
:
${details.exception.toString().split("\n")[0]}
'
);
debugPrint
(
'Another exception was
thrown
:
${details.exception.toString().split("\n")[0]}
'
);
}
_errorCount
+=
1
;
}
...
...
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