Skip to content

Commit

Permalink
Merge pull request #148 from freakingawesome/include-context-in-error…
Browse files Browse the repository at this point in the history
…-templates

Include Context.String() as parameter for error messages
  • Loading branch information
xeipuuv authored Apr 30, 2017
2 parents 20fdae5 + 8cbc83b commit a55c211
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ func newError(err ResultError, context *jsonContext, value interface{}, locale l
err.SetValue(value)
err.SetDetails(details)
details["field"] = err.Field()

if _, exists := details["context"]; !exists && context != nil {
details["context"] = context.String()
}

err.SetDescription(formatErrorDescription(d, details))
}

Expand Down

0 comments on commit a55c211

Please sign in to comment.