open-vault/logical/error.go

24 lines
314 B
Go
Raw Normal View History

package logical
type HTTPCodedError interface {
2016-08-19 20:48:32 +00:00
Error() string
Code() int
}
func CodedError(c int, s string) HTTPCodedError {
2016-08-19 20:48:32 +00:00
return &codedError{s, c}
}
type codedError struct {
2016-08-19 20:48:32 +00:00
s string
code int
}
func (e *codedError) Error() string {
2016-08-19 20:48:32 +00:00
return e.s
}
func (e *codedError) Code() int {
2016-08-19 20:48:32 +00:00
return e.code
}