aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/Message.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-04-25 08:54:24 +0000
committerMaximilian Krambach <[email protected]>2018-04-25 08:54:24 +0000
commitc72adc00965fe4fcedd9d18609211021a091b28b (patch)
treeaf1cc5df7da410f42f2762da9b03b5ca3d39087d /lang/js/src/Message.js
parentjs: allow openpgp-like Message objects as Data (diff)
downloadgpgme-c72adc00965fe4fcedd9d18609211021a091b28b.tar.gz
gpgme-c72adc00965fe4fcedd9d18609211021a091b28b.zip
js: change in Error behaviour
-- * Error objects will now return the error code if defined as error type in src/Errors.js, or do a console.log if it is a warning. Errors from the native gpgme-json will be marked as GNUPG_ERROR.
Diffstat (limited to '')
-rw-r--r--lang/js/src/Message.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js
index f5e21e00..1b36f11d 100644
--- a/lang/js/src/Message.js
+++ b/lang/js/src/Message.js
@@ -39,20 +39,20 @@ export class GPGME_Message {
*/
setParameter(param,value){
if (!param || typeof(param) !== 'string'){
- return new GPGMEJS_Error('WRONGPARAM', 'type check failed');
+ return GPGMEJS_Error('PARAM_WRONG');
}
if (!this._msg || !this._msg.op){
- return new GPGMEJS_Error('MSG_OP_PENDING');
+ return GPGMEJS_Error('MSG_OP_PENDING');
}
let po = permittedOperations[this._msg.op];
if (!po){
- return new GPGMEJS_Error('WRONG_OP', param);
+ return GPGMEJS_Error('MSG_WRONG_OP');
}
if (po.required.indexOf(param) >= 0 || po.optional.indexOf(param) >= 0){
this._msg[param] = value;
return true;
}
- return new GPGMEJS_Error('WRONGPARAM', param);
+ return GPGMEJS_Error('PARAM_WRONG');
}
/**
@@ -98,7 +98,7 @@ export class GPGME_Message {
*/
function setOperation (scope, operation){
if (!operation || typeof(operation) !== 'string'){
- return new GPGMEJS_Error('WRONGTYPE');
+ return GPGMEJS_Error('PARAM_WRONG');
}
if (permittedOperations.hasOwnProperty(operation)){
if (!scope._msg){
@@ -106,6 +106,6 @@ function setOperation (scope, operation){
}
scope._msg.op = operation;
} else {
- return new GPGMEJS_Error('WRONG_OP');
+ return GPGMEJS_Error('MSG_WRONG_OP');
}
} \ No newline at end of file