forked from beatlabs/patron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
71 lines (56 loc) · 1.54 KB
/
errors.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
package sync
// ValidationError defines a validation error.
type ValidationError struct {
err string
}
func (e *ValidationError) Error() string {
return e.err
}
// NewValidationError creates a new validation error.
func NewValidationError(msg string) *ValidationError {
return &ValidationError{err: msg}
}
// UnauthorizedError defines a authorization error.
type UnauthorizedError struct {
err string
}
func (e *UnauthorizedError) Error() string {
return e.err
}
// NewUnauthorizedError creates a new unauthorized error.
func NewUnauthorizedError(msg string) *UnauthorizedError {
return &UnauthorizedError{err: msg}
}
// ForbiddenError defines a access error.
type ForbiddenError struct {
err string
}
func (e *ForbiddenError) Error() string {
return e.err
}
// NewForbiddenError creates a new forbidden error.
func NewForbiddenError(msg string) *ForbiddenError {
return &ForbiddenError{err: msg}
}
// NotFoundError defines a not found error.
type NotFoundError struct {
err string
}
func (e *NotFoundError) Error() string {
return e.err
}
// NewNotFoundError creates a new not found error.
func NewNotFoundError(msg string) *NotFoundError {
return &NotFoundError{err: msg}
}
// ServiceUnavailableError defines a service unavailable error.
type ServiceUnavailableError struct {
err string
}
func (e *ServiceUnavailableError) Error() string {
return e.err
}
// NewServiceUnavailableError creates a new service unavailable error.
func NewServiceUnavailableError(msg string) *ServiceUnavailableError {
return &ServiceUnavailableError{err: msg}
}