forked from gofiber/fiber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
76 lines (61 loc) · 2.76 KB
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package fiber
import (
"encoding/json"
"errors"
"github.com/gofiber/schema"
)
// Wrap and return this for unreachable code if panicking is undesirable (i.e., in a handler).
// Unexported because users will hopefully never need to see it.
var errUnreachable = errors.New("fiber: unreachable code, please create an issue at github.com/gofiber/fiber")
// General errors
var (
ErrGracefulTimeout = errors.New("shutdown: graceful timeout has been reached, exiting")
// ErrNotRunning indicates that a Shutdown method was called when the server was not running.
ErrNotRunning = errors.New("shutdown: server is not running")
// ErrHandlerExited is returned by App.Test if a handler panics or calls runtime.Goexit().
ErrHandlerExited = errors.New("runtime.Goexit() called in handler or server panic")
)
// Fiber redirection errors
var (
ErrRedirectBackNoFallback = NewError(StatusInternalServerError, "Referer not found, you have to enter fallback URL for redirection.")
)
// Range errors
var (
ErrRangeMalformed = errors.New("range: malformed range header string")
ErrRangeUnsatisfiable = errors.New("range: unsatisfiable range")
)
// Binder errors
var ErrCustomBinderNotFound = errors.New("binder: custom binder not found, please be sure to enter the right name")
// Format errors
var (
// ErrNoHandlers is returned when c.Format is called with no arguments.
ErrNoHandlers = errors.New("format: at least one handler is required, but none were set")
)
// gorilla/schema errors
type (
// ConversionError Conversion error exposes the internal schema.ConversionError for public use.
ConversionError = schema.ConversionError
// UnknownKeyError error exposes the internal schema.UnknownKeyError for public use.
UnknownKeyError = schema.UnknownKeyError
// EmptyFieldError error exposes the internal schema.EmptyFieldError for public use.
EmptyFieldError = schema.EmptyFieldError
// MultiError error exposes the internal schema.MultiError for public use.
MultiError = schema.MultiError
)
// encoding/json errors
type (
// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
// (The argument to Unmarshal must be a non-nil pointer.)
InvalidUnmarshalError = json.InvalidUnmarshalError
// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method.
MarshalerError = json.MarshalerError
// A SyntaxError is a description of a JSON syntax error.
SyntaxError = json.SyntaxError
// An UnmarshalTypeError describes a JSON value that was
// not appropriate for a value of a specific Go type.
UnmarshalTypeError = json.UnmarshalTypeError
// An UnsupportedTypeError is returned by Marshal when attempting
// to encode an unsupported value type.
UnsupportedTypeError = json.UnsupportedTypeError
UnsupportedValueError = json.UnsupportedValueError
)