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
1393b4c6
Commit
1393b4c6
authored
Aug 24, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #781 from Hixie/better-exceptions
Better exception handling for rendering library.
parents
a4182561
d99641dd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
15 deletions
+42
-15
flex.dart
packages/flutter/lib/rendering/flex.dart
+1
-1
object.dart
packages/flutter/lib/rendering/object.dart
+33
-14
framework.dart
packages/flutter/lib/widgets/framework.dart
+8
-0
No files found.
packages/flutter/lib/rendering/flex.dart
View file @
1393b4c6
...
...
@@ -512,7 +512,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
String
toStringName
()
{
String
header
=
super
.
toStringName
();
if
(
_overflow
>
0.0
)
if
(
_overflow
is
double
&&
_overflow
>
0.0
)
header
+=
' OVERFLOWING'
;
return
header
;
}
...
...
packages/flutter/lib/rendering/object.dart
View file @
1393b4c6
...
...
@@ -318,6 +318,24 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
// Override in subclasses with children and call the visitor for each child.
void
visitChildren
(
RenderObjectVisitor
visitor
)
{
}
dynamic
debugExceptionContext
=
''
;
static
dynamic
_debugLastException
;
bool
_debugReportException
(
dynamic
exception
,
String
method
)
{
if
(!
inDebugBuild
)
{
print
(
'Uncaught exception in
${method}
():
\n
$exception
'
);
return
false
;
}
if
(!
identical
(
exception
,
_debugLastException
))
{
print
(
'-- EXCEPTION --'
);
print
(
'An exception was raised during
${method}
().'
);
'The following RenderObject was being processed when the exception was fired:
\n
${this}
'
.
split
(
'
\n
'
).
forEach
(
print
);
if
(
debugExceptionContext
!=
''
)
'The RenderObject had the following exception context:
\n
${debugExceptionContext}
'
.
split
(
'
\n
'
).
forEach
(
print
);
_debugLastException
=
exception
;
}
return
true
;
}
static
bool
_debugDoingLayout
=
false
;
static
bool
get
debugDoingLayout
=>
_debugDoingLayout
;
bool
_debugDoingThisResize
=
false
;
...
...
@@ -443,10 +461,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return
true
;
});
}
catch
(
e
)
{
print
(
'Exception raised during layout:
\n
${e}
\n
Context:
\n
${this}
'
);
if
(
inDebugBuild
)
if
(
_debugReportException
(
e
,
'layoutWithoutResize'
))
rethrow
;
return
;
}
_needsLayout
=
false
;
markNeedsPaint
();
...
...
@@ -482,6 +498,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_debugActiveLayout
=
this
;
return
true
;
});
try
{
performLayout
();
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
...
...
@@ -490,6 +507,10 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return
true
;
});
assert
(
debugDoesMeetConstraints
());
}
catch
(
e
)
{
if
(
_debugReportException
(
e
,
'layout'
))
rethrow
;
}
_needsLayout
=
false
;
markNeedsPaint
();
assert
(
parent
==
this
.
parent
);
// TODO(ianh): Remove this once the analyzer is cleverer
...
...
@@ -666,10 +687,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_paintWithContext
(
context
,
Offset
.
zero
);
context
.
endRecording
();
}
catch
(
e
)
{
print
(
'Exception raised during _paintLayer:
\n
${e}
\n
Context:
\n
${this}
'
);
if
(
inDebugBuild
)
if
(
_debugReportException
(
e
,
'_repaint'
))
rethrow
;
return
;
}
}
void
_paintWithContext
(
PaintingContext
context
,
Offset
offset
)
{
...
...
packages/flutter/lib/widgets/framework.dart
View file @
1393b4c6
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'dart:collection'
;
import
'dart:sky'
as
sky
;
import
'package:sky/base/debug.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/base/scheduler.dart'
as
scheduler
;
import
'package:sky/mojo/activity.dart'
;
...
...
@@ -955,6 +956,13 @@ abstract class RenderObjectWrapper extends Widget {
_ancestor
=
old
.
_ancestor
;
assert
(
_renderObject
!=
null
);
}
if
(
inDebugBuild
)
{
try
{
throw
null
;
}
catch
(
_
,
stack
)
{
_renderObject
.
debugExceptionContext
=
stack
;
}
}
assert
(
_renderObject
==
renderObject
);
// in case a subclass reintroduces it
assert
(
renderObject
!=
null
);
assert
(
mounted
);
...
...
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