Index: pkg/template_binding/lib/src/template_iterator.dart |
diff --git a/pkg/template_binding/lib/src/template_iterator.dart b/pkg/template_binding/lib/src/template_iterator.dart |
index 66d44f5de32de4591f60dc7b845aa976adf699c1..855bf7182b7d154fdb29c5e0a6dd284bc9d0fdc3 100644 |
--- a/pkg/template_binding/lib/src/template_iterator.dart |
+++ b/pkg/template_binding/lib/src/template_iterator.dart |
@@ -430,13 +430,23 @@ class _TemplateIterator extends Bindable { |
instanceBindings = instance.instanceBindings; |
instanceNodes = instance.nodes; |
} else { |
- instanceBindings = []; |
- if (_instanceModelFn != null) { |
- model = _instanceModelFn(model); |
- } |
- if (model != null) { |
- fragment = _templateExt.createInstance(model, delegate, |
- instanceBindings); |
+ try { |
+ instanceBindings = []; |
+ if (_instanceModelFn != null) { |
+ model = _instanceModelFn(model); |
+ } |
+ if (model != null) { |
+ fragment = _templateExt.createInstance(model, delegate, |
+ instanceBindings); |
+ } |
+ } catch (e, s) { |
+ // Dart note: we propagate errors asynchronously here to avoid |
+ // disrupting the rendering flow. This is different than in the JS |
+ // implementation but it should probably be fixed there too. Dart |
+ // hits this case more because non-existing properties in |
+ // [PropertyPath] are treated as errors, while JS treats them as |
+ // null/undefined. |
+ new Completer().completeError(e, s); |
} |
} |