aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/Connection.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-05-07 16:27:25 +0000
committerMaximilian Krambach <[email protected]>2018-05-07 16:27:25 +0000
commit8f3d83e5f0903323ec92f588f60dcecb0ae96de4 (patch)
tree65620180493539aacb6f5368a06f3ba63da19d96 /lang/js/src/Connection.js
parentjs: fixing errors found by testing (diff)
downloadgpgme-8f3d83e5f0903323ec92f588f60dcecb0ae96de4.tar.gz
gpgme-8f3d83e5f0903323ec92f588f60dcecb0ae96de4.zip
js: fixing errors found by testing: encrypt/decrypt
-- * Key.js: Error code for wrong parameter in createKey should be "PARAM_WRONG" * Helpers.js: The property openpgpjs-like Objects were checked for in toKeyIdArray was not defined. * src/permittedOperations.js: updated more expectations and assumptions for the native API * new Problems: - There seems to be a message size limit of about 21 MB for nativeMessaging, much lower than the documented 4GB. - Some bytes are lost with random data in an encrypt-decrypt roundtrip. The culprit is unclear.
Diffstat (limited to '')
-rw-r--r--lang/js/src/Connection.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js
index a198bdc6..2c8792d6 100644
--- a/lang/js/src/Connection.js
+++ b/lang/js/src/Connection.js
@@ -99,11 +99,12 @@ export class Connection{
me._connection.onMessage.removeListener(listener)
reject(gpgme_error('CONN_EMPTY_GPG_ANSWER'));
} else if (msg.type === "error"){
- me._connection.onMessage.removeListener(listener)
+ me._connection.onMessage.removeListener(listener);
reject(gpgme_error('GNUPG_ERROR', msg.msg));
} else {
let answer_result = answer.add(msg);
if (answer_result !== true){
+ me._connection.onMessage.removeListener(listener);
reject(answer_result);
}
if (msg.more === true){
@@ -127,8 +128,12 @@ export class Connection{
}, 5000);
}]).then(function(result){
return result;
- }, function(error){
- return error;
+ }, function(reject){
+ if(!reject instanceof Error) {
+ return gpgme_error('GNUPG_ERROR', reject);
+ } else {
+ return reject;
+ }
});
}
});
@@ -196,7 +201,7 @@ class Answer{
this._response.push(msg[key]);
}
else {
- return gpgme_error('CONN_UNEXPECTED_ANSWER', key);
+ return gpgme_error('CONN_UNEXPECTED_ANSWER');
}
break;
}