Skip to content

Commit

Permalink
Cannot parse given Error object
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsharE committed May 26, 2023
1 parent 7f9cabb commit 05fed5c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions dist/elmahio.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/elmahio.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/elmahio.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/elmahio.min.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/elmahio.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@

if (type !== "Log") {

var stack = error ? ErrorStackParser.parse(error) : null;
var stack = error && error instanceof Error ? ErrorStackParser.parse(error) : null;

var jsonData = {
"title": message,
Expand Down Expand Up @@ -1225,16 +1225,17 @@
// on message event
publicAPIs.emit('message', jsonData);

if (error && type !== "Log" && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) {
if (error && error instanceof Error && type !== "Log" && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) {
// send message trying to pinpoint stackframes
stackGPS(error, xhr, jsonData);
} else {
// send message
if(jsonData.errorObject) {
if(jsonData.errorObject && jsonData.errorObject instanceof Error) {
error = jsonData.errorObject;
delete jsonData.errorObject;
stackGPS(error, xhr, jsonData);
} else {
delete jsonData.errorObject;
xhr.send(JSON.stringify(jsonData));
}
}
Expand Down

0 comments on commit 05fed5c

Please sign in to comment.