Skip to content

Commit f85cf7d

Browse files
committed
Catching and rethrowing exceptions, so that mapping nesting level can be reset
1 parent 8f9e83e commit f85cf7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

knockout.mapping.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
exports.fromJS = function (jsObject /*, inputOptions, target*/ ) {
8080
if (arguments.length == 0) throw new Error("When calling ko.fromJS, pass the object you want to convert.");
8181

82-
// When mapping is completed, even with an exception, reset the nesting level
8382
try {
8483
if (!mappingNesting++) {
8584
dependentObservables = [];
@@ -124,8 +123,9 @@
124123
result[mappingProperty] = merge(result[mappingProperty], options);
125124

126125
return result;
127-
} finally {
126+
} catch(e) {
128127
mappingNesting = 0;
128+
throw e;
129129
}
130130
};
131131

0 commit comments

Comments
 (0)