diff options
author | Maximilian Krambach <[email protected]> | 2018-07-27 18:36:21 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-07-27 18:36:21 +0000 |
commit | 94ee0988d4eaac27785de6efb7c19ca9976e1e9c (patch) | |
tree | b9a06e35d1a2831cb0750177daa978314b9be481 /lang/js/src/Errors.js | |
parent | js: clean up test extension (diff) | |
download | gpgme-94ee0988d4eaac27785de6efb7c19ca9976e1e9c.tar.gz gpgme-94ee0988d4eaac27785de6efb7c19ca9976e1e9c.zip |
js: change the write access for js class methods
--
* src/ [Connection, Error, Key, Keyring, MEssage, Signature, gpgmejs]:
Functions and values that are not meant to be overwritten are now
moved into their constructors, thus eliminating the possibility of
overwrites after initialization.
* Key: The mode of use (synchronous cached, or async promises) ivs now
determined at initialization of that Key. The property Key.isAsync
reflects this state.
* unittests: fixed old Key syntax for testing.
* Message.js isComplete is now a method and not a getter anymore.
* Added some startup tests.
Diffstat (limited to 'lang/js/src/Errors.js')
-rw-r--r-- | lang/js/src/Errors.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js index cb5c94c2..0cf1af19 100644 --- a/lang/js/src/Errors.js +++ b/lang/js/src/Errors.js @@ -143,7 +143,7 @@ export function gpgme_error(code = 'GENERIC_ERROR', info){ * @extends Error */ class GPGME_Error extends Error{ - constructor(code, msg=''){ + constructor(code = 'GENERIC_ERROR', msg=''){ if (code === 'GNUPG_ERROR' && typeof(msg) === 'string'){ super(msg); } else if (err_list.hasOwnProperty(code)){ @@ -155,12 +155,12 @@ class GPGME_Error extends Error{ } else { super(err_list['GENERIC_ERROR'].msg); } - this.code = code || 'GENERIC_ERROR'; - } - set code(value){ - this._code = value; + this.getCode = function(){ + return code; + }; } + get code(){ - return this._code; + return this.getCode(); } }
\ No newline at end of file |