uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.

Home Page:https://cadenceworkflow.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proper Error Message for Custom Error

prsh9 opened this issue · comments

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