26 lines
320 B
Go
26 lines
320 B
Go
|
package web
|
||
|
|
||
|
import (
|
||
|
ouc "git.loafle.net/overflow/util-go/ctx"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
ErrorKey = ouc.CtxtKey("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()
|
||
|
}
|