Skip to content

Commit

Permalink
Don't print stack traces to stderr
Browse files Browse the repository at this point in the history
They are too noisy and don't add much.
  • Loading branch information
twiss committed Jul 8, 2024
1 parent d35fe10 commit 0fa3ce8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions decrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const decrypt = async (withPassword, sessionKeyOut, withSessionKey, verifyWith,
try {
message = await openpgp.readMessage({ armoredMessage: encrypted.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand All @@ -33,7 +33,7 @@ const decrypt = async (withPassword, sessionKeyOut, withSessionKey, verifyWith,
openpgp.decrypt(options).then((clearText) => {
process.stdout.write(clearText.data);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(CANNOT_DECRYPT);
});
return;
Expand All @@ -53,7 +53,7 @@ const decrypt = async (withPassword, sessionKeyOut, withSessionKey, verifyWith,
openpgp.decrypt(options).then(async (clearText) => {
process.stdout.write(clearText.data);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(CANNOT_DECRYPT);
});
return;
Expand All @@ -72,7 +72,7 @@ const decrypt = async (withPassword, sessionKeyOut, withSessionKey, verifyWith,
message,
decryptionKeys
}).catch((e) => {
console.error(e);
console.error(e.message);
process.exit(CANNOT_DECRYPT);
});

Expand All @@ -96,7 +96,7 @@ const decrypt = async (withPassword, sessionKeyOut, withSessionKey, verifyWith,
try {
verified = await s.verified;
} catch (e) {
console.error(e);
console.error(e.message);
verified = false;
}
if (verified) {
Expand Down
2 changes: 1 addition & 1 deletion encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const encrypt = async (withPassword, signWith, withKeyPassword, certfiles) => {
openpgp.encrypt(options).then((ciphertext) => {
process.stdout.write(ciphertext);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(CERT_CANNOT_ENCRYPT);
});
};
Expand Down
2 changes: 1 addition & 1 deletion generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const generateKey = async (withKeyPassword, armor, userids) => {
openpgp.generateKey(options).then(async (key) => {
process.stdout.write(key.privateKey);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
});
};
Expand Down
4 changes: 2 additions & 2 deletions inlineDetach.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const inlineDetach = async (signaturesOut, armor) => {
try {
message = await openpgp.readCleartextMessage({ cleartextMessage: data.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand All @@ -40,7 +40,7 @@ const inlineDetach = async (signaturesOut, armor) => {
}
process.stdout.write(sig.data);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
});
};
Expand Down
6 changes: 3 additions & 3 deletions inlineVerify.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const inlineVerify = async (certfiles, verificationsOut) => {
try {
message = await openpgp.readCleartextMessage({ cleartextMessage: data.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand All @@ -38,7 +38,7 @@ const inlineVerify = async (certfiles, verificationsOut) => {
try {
verified = await s.verified;
} catch (e) {
console.error(e);
console.error(e.message);
verified = false;
}
if (verified) {
Expand Down Expand Up @@ -66,7 +66,7 @@ const inlineVerify = async (certfiles, verificationsOut) => {
}
process.stdout.write(sig.data);
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
});
};
Expand Down
4 changes: 2 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const load_certs = async (...filenames) => {
try {
certs = await openpgp.readKeys({ armoredKeys: buf.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand All @@ -36,7 +36,7 @@ const load_keys = async (...filenames) => {
try {
keys = await openpgp.readPrivateKeys({ armoredKeys: buf.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand Down
6 changes: 3 additions & 3 deletions verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const verify = async (signature, certfiles) => {
try {
sig = await openpgp.readSignature({ armoredSignature: sigBuf.toString('utf8') });
} catch (e) {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
}
}
Expand All @@ -36,7 +36,7 @@ const verify = async (signature, certfiles) => {
try {
verified = await s.verified;
} catch (e) {
console.error(e);
console.error(e.message);
verified = false;
}
if (verified) {
Expand All @@ -59,7 +59,7 @@ const verify = async (signature, certfiles) => {
return process.exit(NO_SIGNATURE);
}
}).catch((e) => {
console.error(e);
console.error(e.message);
return process.exit(BAD_DATA);
});
};
Expand Down

0 comments on commit 0fa3ce8

Please sign in to comment.