[Pkg-javascript-commits] [node-asn1.js] 13/202: base: better error reporting in encoder
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Apr 20 19:18:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-asn1.js.
commit 38ebb91c99c839e3cac1595d6d3e2e75fdabd649
Author: Fedor Indutny <fedor.indutny at gmail.com>
Date: Sun Dec 1 23:20:40 2013 +0400
base: better error reporting in encoder
---
lib/asn1/base/node.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/asn1/base/node.js b/lib/asn1/base/node.js
index 4a30f64..e2a7dff 100644
--- a/lib/asn1/base/node.js
+++ b/lib/asn1/base/node.js
@@ -360,12 +360,12 @@ Node.prototype._decodeChoice = function decodeChoice(input, obj) {
// Encoding
//
-Node.prototype._encode = function encode(data) {
+Node.prototype._encode = function encode(data, path) {
var state = this._baseState;
// Decode root node
if (state.parent === null)
- return state.children[0]._encode(data);
+ return state.children[0]._encode(data, '');
var result = null;
var present = true;
@@ -387,7 +387,12 @@ Node.prototype._encode = function encode(data) {
} else if (state.children) {
content = state.children.map(function(child) {
assert(child._baseState.key, 'Child should have a key');
- return child._encode(data[child._baseState.key]);
+ var newpath = path + '.' + child._baseState.key;
+ try {
+ return child._encode(data[child._baseState.key], newpath);
+ } catch (e) {
+ throw new Error('Failed to encode: ' + newpath + '\n' + e.stack);
+ }
}, this).filter(function(child) {
return child;
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-asn1.js.git
More information about the Pkg-javascript-commits
mailing list