Skip to content

Commit

Permalink
Add proper, helpful error messages for the dict decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
schroffl committed Dec 24, 2024
1 parent 4280067 commit b8ef9c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@
if (isOk(child_value)) {
result[key] = child_value.value;
} else {
// TODO Wrap in key info
return child_value;
var msg = 'Failed to decode dictionary, because attempting to decode the field \'' + key + '\' failed with the following error:\n\n';
msg += child_value.msg;
msg += '\nwhen attempting to decode the field \'' + key + '\' of\n' + toDebugString(value);
return err(msg);
}
}

Expand Down

0 comments on commit b8ef9c9

Please sign in to comment.