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.
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.