26 lines
326 B
Go
26 lines
326 B
Go
package web
|
|
|
|
import (
|
|
cuc "git.loafle.net/commons/util-go/context"
|
|
)
|
|
|
|
const (
|
|
ErrorKey = cuc.ContextKey("ErrorKey")
|
|
)
|
|
|
|
func NewError(code int, cause error) *Error {
|
|
return &Error{
|
|
Code: code,
|
|
Cause: cause,
|
|
}
|
|
}
|
|
|
|
type Error struct {
|
|
Code int
|
|
Cause error
|
|
}
|
|
|
|
func (e *Error) Error() string {
|
|
return e.Cause.Error()
|
|
}
|