aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/Errors.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-07-10 12:32:26 +0000
committerMaximilian Krambach <[email protected]>2018-07-10 12:32:26 +0000
commit4015f5b4983c8a4590aa71776880d8bc42c7918d (patch)
tree2a4b6bd7a5e791a46cfca9143559ff8e8b20234e /lang/js/src/Errors.js
parentjs: fix verify result reporting (diff)
downloadgpgme-4015f5b4983c8a4590aa71776880d8bc42c7918d.tar.gz
gpgme-4015f5b4983c8a4590aa71776880d8bc42c7918d.zip
js: documentation
-- * Fixed errors: - src/Message.js post(): Set chunksize to defined default value instead of hardcoded - src/Keys.js: added getHasSecret() to refreshKey operation. * Reviewed and updated the documentation * non-documentation changes which do not affect functionality: - src/Errors: disabled a console.warn that is only useful for debugging - helpers.js: renamed "string" to "value" in isFingerprint and isLongId to avoid confusion - src/Keyring: prepare_sync, search are both explicitly set to false by default
Diffstat (limited to '')
-rw-r--r--lang/js/src/Errors.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/lang/js/src/Errors.js b/lang/js/src/Errors.js
index a8cd8b56..cb5c94c2 100644
--- a/lang/js/src/Errors.js
+++ b/lang/js/src/Errors.js
@@ -21,6 +21,9 @@
* Maximilian Krambach <[email protected]>
*/
+/**
+ * Listing of all possible error codes and messages of a {@link GPGME_Error}.
+ */
const err_list = {
// Connection
'CONN_NO_CONNECT': {
@@ -107,10 +110,11 @@ const err_list = {
};
/**
- * Checks the given error code and returns an error object with some
- * information about meaning and origin
+ * Checks the given error code and returns an {@link GPGME_Error} error object
+ * with some information about meaning and origin
* @param {*} code Error code. Should be in err_list or 'GNUPG_ERROR'
* @param {*} info Error message passed through if code is 'GNUPG_ERROR'
+ * @returns {GPGME_Error}
*/
export function gpgme_error(code = 'GENERIC_ERROR', info){
if (err_list.hasOwnProperty(code)){
@@ -119,7 +123,7 @@ export function gpgme_error(code = 'GENERIC_ERROR', info){
}
if (err_list[code].type === 'warning'){
// eslint-disable-next-line no-console
- console.warn(code + ': ' + err_list[code].msg);
+ // console.warn(code + ': ' + err_list[code].msg);
}
return null;
} else if (code === 'GNUPG_ERROR'){
@@ -130,6 +134,14 @@ export function gpgme_error(code = 'GENERIC_ERROR', info){
}
}
+/**
+ * An error class with additional info about the origin of the error, as string
+ * @property {String} code Short description of origin and type of the error
+ * @property {String} msg Additional info
+ * @class
+ * @protected
+ * @extends Error
+ */
class GPGME_Error extends Error{
constructor(code, msg=''){
if (code === 'GNUPG_ERROR' && typeof(msg) === 'string'){