-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Marshal error with full context chain
When using the new `Augment` function to add context and wrap errors, the error message in Go is chained and displayed with the full chain of context: ``` err := InternalService("code", "message", nil) augmentedErr := Augment(err, "context", nil) // This is "internal_service.code: context: message" augmentedErr.Error() ``` But the marshaled error only displays the first level of context, i.e. ``` // This is just "context" Marshal(augmentedErr.(*Error)).Message ``` This commit changes the Marshal behaviour to include the full context chain of error, so it's actually useful outside of Go when marshaled. ``` // This is now "context: message" Marshal(augmentedErr).(*Error).Message ```
- Loading branch information
Showing
2 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters