Fix: Fix incorrect error handling

This commit is contained in:
Nelson Chan 2021-07-23 11:23:43 +08:00
parent 4d262bbb6a
commit 6b72d5033a

View File

@ -97,8 +97,7 @@ exports.checkCertificate = function (res) {
} = res.request.res.socket.getPeerCertificate(false);
if (!valid_from || !valid_to || !subjectaltname) {
reject(new Error('No certificate'));
return;
throw { message: 'No TLS certificate in response' };
}
const valid = res.request.res.socket.authorized || false;