Skip to content

Commit

Permalink
Update parseBrowserError function to ensure name and message properti…
Browse files Browse the repository at this point in the history
…es exist on error object when looking for timeout errors
  • Loading branch information
akuny committed Jul 17, 2024
1 parent 73febac commit 01a7fb3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions entities/scan-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ export enum ScanStatus {

export const parseBrowserError = (err: Error): ScanStatus => {
if (
err.name === 'TimeoutError' ||
err.message.startsWith('net::ERR_CONNECTION_TIMED_OUT') ||
err.message.startsWith('connect ETIMEDOUT')
(err.name && err.name === 'TimeoutError') ||
(err.message &&
(err.message.startsWith('net::ERR_CONNECTION_TIMED_OUT') ||
err.message.startsWith('connect ETIMEDOUT')))
) {
return ScanStatus.Timeout;
}
Expand Down

0 comments on commit 01a7fb3

Please sign in to comment.