mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-01 17:53:39 +00:00
18 lines
401 B
Go
18 lines
401 B
Go
package util
|
|
|
|
import "fmt"
|
|
|
|
// HTTPError An HTTP Error response, which may wrap an underlying native Go Error.
|
|
type HTTPError struct {
|
|
WrappedError error
|
|
Message string
|
|
Code int
|
|
}
|
|
|
|
func (e HTTPError) Error() string {
|
|
var wrappedErrMsg string
|
|
if e.WrappedError != nil {
|
|
wrappedErrMsg = e.WrappedError.Error()
|
|
}
|
|
return fmt.Sprintf("%s: %d: %s", e.Message, e.Code, wrappedErrMsg)
|
|
}
|