D
Deno

help

distinguis `netERR_CONNECTION_TIMED_OUT` from `netERR_CERT_AUTHORITY_INVALID`

CChilliSniff10/1/2022
i get net::ERR_CERT_AUTHORITY_INVALID because i use self signed certs on the domain localhost now i want to check if the net::ERR_CERT_AUTHORITY_INVALID occurs, and if so the user should receive a message, but how can i distingish form other network errors like if the server is down fetch would throw a net::ERR_CONNECTION_REFUSED when i catch the fetch error , all i get is:
e instanceof TypeError: true
client.module.js:199 e.message: Failed to fetch
client.module.js:200 e.name: TypeError
client.module.js:201 e.fileName: undefined
client.module.js:202 e.lineNumber: undefined
client.module.js:203 e.columnNumber: undefined
client.module.js:204 e.stack: TypeError: Failed to fetch
at yn.mounted (https://localhost:8443/client.module.js:195:36)
at Rt (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:10992)
at qe (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:24968)
at https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:67609
at yn.$mount (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:67628)
at yn.$mount (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:92832)
at e._init (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:32472)
at new yn (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:29795)
at https://localhost:8443/client.module.js:156:20
client.module.js:206
e instanceof TypeError: true
client.module.js:199 e.message: Failed to fetch
client.module.js:200 e.name: TypeError
client.module.js:201 e.fileName: undefined
client.module.js:202 e.lineNumber: undefined
client.module.js:203 e.columnNumber: undefined
client.module.js:204 e.stack: TypeError: Failed to fetch
at yn.mounted (https://localhost:8443/client.module.js:195:36)
at Rt (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:10992)
at qe (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:24968)
at https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:67609
at yn.$mount (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:67628)
at yn.$mount (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:92832)
at e._init (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:32472)
at new yn (https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.min.js:6:29795)
at https://localhost:8443/client.module.js:156:20
client.module.js:206

Looking for more? Join the community!