Refactor ReactMultiChild to not throw errors too
Missed these when I fixed up Transaction; with the exception of ReactErrorUtils, this should be everything.
Ben Alpert committed
Feb 4, 2014 at 11:06 UTC
35d9286781cce05e9862d5bc7c63233dbcc815b4
1 file changed
+12
-10
src/core/ReactMultiChild.js
+12
-10
@@ -215,6 +215,7 @@ var ReactMultiChild = {
215
*/
216
updateTextContent: function(nextContent) {
217
updateDepth++;
218
+ var errorThrown = true;
219
try {
220
var prevChildren = this._renderedChildren;
221
// Remove any rendered children.
@@ -225,13 +226,13 @@ var ReactMultiChild = {
226
}
227
// Set new text content.
228
this.setTextContent(nextContent);
228
- } catch (error) {
229
+ errorThrown = false;
230
+ } finally {
231
updateDepth--;
230
- updateDepth || clearQueue();
231
- throw error;
232
+ if (!updateDepth) {
233
+ errorThrown ? clearQueue() : processQueue();
234
+ }
235
}
233
- updateDepth--;
234
- updateDepth || processQueue();
236
},
237
238
/**
@@ -243,15 +244,16 @@ var ReactMultiChild = {
244
*/
245
updateChildren: function(nextNestedChildren, transaction) {
246
updateDepth++;
247
+ var errorThrown = true;
248
try {
249
this._updateChildren(nextNestedChildren, transaction);
248
- } catch (error) {
250
+ errorThrown = false;
251
+ } finally {
252
updateDepth--;
250
- updateDepth || clearQueue();
251
- throw error;
253
+ if (!updateDepth) {
254
+ errorThrown ? clearQueue() : processQueue();
255
+ }
256
}
253
- updateDepth--;
254
- updateDepth || processQueue();
257
},
258
259
/**