Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorMessage ¶
ErrorMessage extracts a specified error response to be returned to the caller if present, otherwise returns the default error string
func LogData ¶
LogData returns logData for an error if there is any. This is used to extract log.Data embedded in an error if it implements the dataLogger interface
func StackTrace ¶
func StackTrace(err error) []log.EventStackTrace
StackTrace recursively unwraps the error looking for the deepest level at which the error was wrapped with a stack trace from github.com/pkg/errors (or conforms to the StackTracer interface) and returns the slice of stack frames. These can are of type log.go/EventStackTrace so can be used directly with log.Go's available API to preserve the correct error logging format
func StatusCode ¶
StatusCode attempts to extract a status code from an error, or returns 0 if not found
func UnwrapLogData ¶
UnwrapLogData recursively unwraps logData from an error. This allows an error to be wrapped with log.Data at each level of the call stack, and then extracted and combined here as a single log.Data entry. This allows us to log errors only once but maintain the context provided by log.Data at each level.
func UnwrapStatusCode ¶
UnwrapStatusCode is a callback function that allows you to extract a status code from an error. If the status code returned is 0, statusCode will attempt to recursively unwrap the error until a non-zero code is returned. If no more code is embedded it will return status 500 as default.
Types ¶
This section is empty.