digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.66k stars 195 forks source link

"cause" field of errors. #442

Open davidlehn opened 3 years ago

davidlehn commented 3 years ago

Some errors, such as invalid scoped context, are thrown in an error handler and don't include the earlier cause. This can be confusing if the real error is a network error or similar rather than the context itself being invalid.

Check for these sorts of errors and determine if the cause field can be safely set. In some cases including the cause might leak too much information to the error consumer. But in many cases it may be very useful to either include it, or extract appropriate details to include.