Skip to content

Commit

Permalink
Handle optional stack parameter in error.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Nov 12, 2023
1 parent 6007857 commit 1dcd8b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class HttpClient {
};
} catch (error) {
const resolvedError = typeof error.json === 'function' ? await error.json().catch(e => e) : error;
const extensionErrorId = resolvedError.stack.match(/chrome-extension:[/][/](\w+)[/]/);
const extensionErrorId = resolvedError.stack && resolvedError.stack.match(/chrome-extension:[/][/](\w+)[/]/);
if (extensionErrorId) {
this.logger.debug({ title: `Fetch failed due to a browser extension - ${method} - ${url}`, method, url, data, headers, error, resolvedError, extensionErrorId });
const newError = new Error(`Extension Error ID: ${extensionErrorId}`);
Expand All @@ -123,7 +123,7 @@ class HttpClient {
}

this.logger.warn({ title: message, online: navigator.onLine, method, url, data, headers, error, resolvedError });
throw error || error;
throw error;
}
}
}
Expand Down

0 comments on commit 1dcd8b0

Please sign in to comment.