feat: better mapping for WS errors

This commit is contained in:
Adhiraj Singh
2023-01-17 22:01:51 +05:30
parent f54e8f8813
commit c24ffc1bed
2 changed files with 22 additions and 9 deletions

View File

@@ -353,7 +353,10 @@ export const getCodeFromWSError = (error: Error) => {
if(!Number.isNaN(code) && code >= 400) {
statusCode = code
}
} else if((error as any).code?.startsWith('E')) { // handle ETIMEOUT, ENOTFOUND etc
} else if(
(error as any).code?.startsWith('E')
|| error?.message?.includes('timed out')
) { // handle ETIMEOUT, ENOTFOUND etc
statusCode = 408
}