Skip to content

Commit b8ef9c9

Browse files
committed
Add proper, helpful error messages for the dict decoder
1 parent 4280067 commit b8ef9c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@
283283
if (isOk(child_value)) {
284284
result[key] = child_value.value;
285285
} else {
286-
// TODO Wrap in key info
287-
return child_value;
286+
var msg = 'Failed to decode dictionary, because attempting to decode the field \'' + key + '\' failed with the following error:\n\n';
287+
msg += child_value.msg;
288+
msg += '\nwhen attempting to decode the field \'' + key + '\' of\n' + toDebugString(value);
289+
return err(msg);
288290
}
289291
}
290292

0 commit comments

Comments
 (0)