Skip to main content

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is a special type of errors called Script ErrorScript Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog postblog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is a special type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is a special type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

Bounty Awarded with 50 reputation awarded by frenchie
deleted 2 characters in body
Source Link
Mouneer
  • 13.5k
  • 3
  • 37
  • 46

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is an especiala special type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is an especial type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is a special type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.

Source Link
Mouneer
  • 13.5k
  • 3
  • 37
  • 46

There are two points you need to be aware of in this case. Both points are independent of each other and should be fixed to solve your problem.

First

The error you're facing is an especial type of errors called Script Error

“Script error” is what browsers send to the onerror callback when an error originates from a JavaScript file served from a different origin (different domain, port, or protocol). It’s painful because even though there’s an error occurring, you don’t know what the error is, nor from which code it’s originating.

This isn’t a JavaScript bug

Browsers intentionally hide errors originating from script files from different origins for security reasons. It’s to avoid a script unintentionally leaking potentially sensitive information to an onerror callback that it doesn’t control. For this reason, browsers only give window.onerror insight into errors originating from the same domain. All we know is that an error occurred – nothing else!

To fix this problem:

To fix and get a normal error object, Check this blog post

Second

When you try to stringify any Error Object, the result will not be satisfying at all because you will lose almost all data.

The reason for that

JSON.stringify deals only with enumerable properties but Error object stores the contextual data in inenumerable properties.

To fix this problem

There are number of solutions but this one could be straight forward

JSON.stringify(err, ["message", "arguments", "type", "name"]) 

This picks the properties you want and generate the string for you.