blob: 3fc4d2fa2ef947048ced4f428e67b327695baa2f [file] [log] [blame]
package errors
import (
"fmt"
"net/http"
)
type Error struct {
Status int
Message string
}
func (e *Error) Code() int {
return e.Status
}
func (e *Error) Error() string {
return e.Message
}
func NewError(status int, message string) *Error {
return &Error{
status,
message,
}
}
var InternalError = NewError(http.StatusInternalServerError, "Server Internal Error")
// Deprecated: use ctx.Err() instead
var TaskCanceled = fmt.Errorf("task got canceled")