diff options
author | Maximilian Krambach <[email protected]> | 2018-04-25 13:59:36 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-04-25 13:59:36 +0000 |
commit | 1fb310cabe578625f96fce5d84ff6f0092c08d24 (patch) | |
tree | 7d86ba979e8a4c39fd75ea2f727cce8c169d4e08 /lang/js/src/index.js | |
parent | js: reactivate timeout on connection (diff) | |
download | gpgme-1fb310cabe578625f96fce5d84ff6f0092c08d24.tar.gz gpgme-1fb310cabe578625f96fce5d84ff6f0092c08d24.zip |
js: Configuration and Error handling
--
* gpgmejs_openpgpjs
- unsuported values with no negative consequences can now reject,
warn or be ignored, according to config.unconsidered_params
- cleanup of unsupported/supported parameters and TODOS
* A src/index.js init() now accepts a configuration object
* Errors will now be derived from Error, offering more info and a
stacktrace.
* Fixed Connection.post() timeout triggering on wrong cases
* Added comments in permittedOperations.js, which gpgme interactions
are still unimplemented and should be added next
Diffstat (limited to '')
-rw-r--r-- | lang/js/src/index.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lang/js/src/index.js b/lang/js/src/index.js index a54277c2..48904316 100644 --- a/lang/js/src/index.js +++ b/lang/js/src/index.js @@ -19,7 +19,7 @@ */ import { GpgME } from "./gpgmejs"; -import { GPGMEJS_Error } from "./Errors"; +import { gpgme_error } from "./Errors"; import { GpgME_openpgpmode } from "./gpgmejs_openpgpjs"; import { Connection } from "./Connection"; @@ -29,7 +29,8 @@ import { Connection } from "./Connection"; */ function init( config = { api_style: 'gpgme', // | gpgme_openpgpjs - null_expire_is_never: true // Boolean + null_expire_is_never: true, // Boolean + unconsidered_params: 'warn'//'warn' || 'reject' }){ return new Promise(function(resolve, reject){ let connection = new Connection; @@ -41,12 +42,12 @@ function init( config = { let gpgme = null; if (config.api_style && config.api_style === 'gpgme_openpgpjs'){ resolve( - new GpgME_openpgpmode(connection)); + new GpgME_openpgpmode(connection, config)); } else { resolve(new GpgME(connection)); } } else { - reject(GPGMEJS_Error('CONN_NO_CONNECT')); + reject(gpgme_error('CONN_NO_CONNECT')); } }; setTimeout(delayedreaction, 5); |