diff options
Diffstat (limited to 'lang/js/src/Errors.js')
-rw-r--r-- | lang/js/src/Errors.js | 18 |
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'){ |