Log swallowed errors in debug mode
This commit is contained in:
parent
7c3bbe9278
commit
5d43b44e50
|
@ -157,7 +157,9 @@ Message.prototype.decryptSessionKeys = async function(privateKeys, passwords) {
|
|||
try {
|
||||
await keyPacket.decrypt(password);
|
||||
keyPackets.push(keyPacket);
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
util.print_debug_error(err);
|
||||
}
|
||||
}));
|
||||
}));
|
||||
} else if (privateKeys) {
|
||||
|
@ -180,7 +182,9 @@ Message.prototype.decryptSessionKeys = async function(privateKeys, passwords) {
|
|||
try {
|
||||
await keyPacket.decrypt(privateKeyPacket);
|
||||
keyPackets.push(keyPacket);
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
util.print_debug_error(err);
|
||||
}
|
||||
}));
|
||||
}));
|
||||
} else {
|
||||
|
|
|
@ -568,7 +568,7 @@ function parseMessage(message, format) {
|
|||
*/
|
||||
function onError(message, error) {
|
||||
// log the stack trace
|
||||
if (config.debug) { console.error(error.stack); }
|
||||
util.print_debug_error(error);
|
||||
|
||||
// update error message
|
||||
error.message = message + ': ' + error.message;
|
||||
|
|
|
@ -54,6 +54,7 @@ List.prototype.read = function (bytes) {
|
|||
parsed.tag === enums.packet.compressed) {
|
||||
throw e;
|
||||
}
|
||||
util.print_debug_error(e);
|
||||
if (pushed) {
|
||||
this.pop(); // drop unsupported packet
|
||||
}
|
||||
|
|
12
src/util.js
12
src/util.js
|
@ -376,6 +376,18 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper function to print a debug error. Debug
|
||||
* messages are only printed if
|
||||
* @link module:config/config.debug is set to true.
|
||||
* @param {String} str String of the debug message
|
||||
*/
|
||||
print_debug_error: function (error) {
|
||||
if (config.debug) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO rewrite getLeftNBits to work with Uint8Arrays
|
||||
getLeftNBits: function (string, bitcount) {
|
||||
const rest = bitcount % 8;
|
||||
|
|
Loading…
Reference in New Issue
Block a user