uber-go/cadence-client

Proper Error Message for Custom Error

prsh9 opened this issue · 0 comments

prsh9 commented

When we create a custom error we give a reason and additional details.
Generally custom errors are created to wrap around other errors with additional context/details for e.g.
customErr := cadence.NewCustomError("Error with making HTTP Call", request.URL, err)

The Error() method returns the reason only which can be improved to include the additional details as generally the this method is useful while logging as the reason alone may sometimes be insufficient in the logs.

Proposed Solution
Error() can be changed to return reason + " Details : " + stringify(details) to give proper message. The Reason() and Details(..) functions still give us control over the required handling