handle certs error properly [WIP] #211

This commit is contained in:
akashnimare
2017-07-13 22:01:20 +05:30
parent 499743e99d
commit 5a2975ca4d

View File

@@ -77,9 +77,13 @@ class DomainUtil {
return new Promise((resolve, reject) => {
request(checkDomain, (error, response) => {
const certsError =
['Error: self signed certificate',
'Error: unable to verify the first certificate'
];
if (!error && response.statusCode !== 404) {
resolve(domain);
} else if (error.toString().indexOf('Error: self signed certificate') >= 0 || 'Error: unable to verify the first certificate') {
} else if (certsError.indexOf(error.toString()) >= 0) {
if (window.confirm(`Do you trust certificate from ${domain}? \n ${error}`)) {
resolve(domain);
} else {