diff options
author | Maximilian Krambach <[email protected]> | 2018-04-25 17:45:39 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-04-25 17:45:39 +0000 |
commit | 3685913bf510a14b8cb324d980217d90489e6453 (patch) | |
tree | eb1acbdee90bf747f2dfbd4c9a61ed83d41c2b8f /lang/js/src/Errors.js | |
parent | js: Configuration and Error handling (diff) | |
download | gpgme-3685913bf510a14b8cb324d980217d90489e6453.tar.gz gpgme-3685913bf510a14b8cb324d980217d90489e6453.zip |
js: First testing and improvements
--
* Introduced Mocha/chai as testsuite. After development build
'npm test' should run the unit tests. Functionality exclusive to
Browsers/WebExtensions cannot be run this way, so some other testing
is still needed.
- package.json: Added required development packages
- .babelrc indirect configuration for mocha. ES6 transpiling
needs some babel configuration, but mocha has no setting for it.
- test/mocha.opts Vonfiguration for mocha runs
* Fixed errors:
- Helpers.js toKeyIdArray; isLongId is now exported
- Key.js Key constructor failed
- Message.js will not throw an Error during construction, a new
message is now created with createMessage, which can return an
Error or a GPGME_Message object
* Tests:
- test/Helpers: exports from Helpers.js, GPGME_Error handling
- test/Message: first init test with bad parameters
Diffstat (limited to 'lang/js/src/Errors.js')
-rw-r--r-- | lang/js/src/Errors.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index 2f53aa89..d26aab18 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -55,14 +55,9 @@ const err_list = { msg: 'The Message is empty.', type: 'error' }, - 'MSG_OP_PENDING': { - msg: 'There is no operation specified yet. The parameter cannot' - + ' be set', - type: 'warning' - }, 'MSG_WRONG_OP': { msg: 'The operation requested could not be found', - type: 'warning' + type: 'error' }, 'MSG_NO_KEYS' : { msg: 'There were no valid keys provided.', @@ -78,7 +73,7 @@ const err_list = { }, // generic 'PARAM_WRONG':{ - msg: 'invalid parameter was found', + msg: 'Invalid parameter was found', type: 'error' }, 'PARAM_IGNORED': { @@ -111,7 +106,7 @@ export function gpgme_error(code = 'GENERIC_ERROR', info){ return new GPGME_Error(code); } if (err_list[code].type === 'warning'){ - console.log(new GPGME_Error(code)); + console.warn(code + ': ' + err_list[code].msg); } return null; } else if (code === 'GNUPG_ERROR'){ |