/
errors.go
59 lines (44 loc) · 1.57 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
package server
import "github.com/unistack-org/micro/v3/errors"
type Error struct {
id string
}
func NewError(id string) *Error {
return &Error{id}
}
func (e *Error) BadRequest(format string, a ...interface{}) error {
return errors.BadRequest(e.id, format, a...)
}
func (e *Error) Unauthorized(format string, a ...interface{}) error {
return errors.Unauthorized(e.id, format, a...)
}
func (e *Error) Forbidden(format string, a ...interface{}) error {
return errors.Forbidden(e.id, format, a...)
}
func (e *Error) NotFound(format string, a ...interface{}) error {
return errors.NotFound(e.id, format, a...)
}
func (e *Error) MethodNotAllowed(format string, a ...interface{}) error {
return errors.MethodNotAllowed(e.id, format, a...)
}
func (e *Error) Timeout(format string, a ...interface{}) error {
return errors.Timeout(e.id, format, a...)
}
func (e *Error) Conflict(format string, a ...interface{}) error {
return errors.Conflict(e.id, format, a...)
}
func (e *Error) InternalServerError(format string, a ...interface{}) error {
return errors.InternalServerError(e.id, format, a...)
}
func (e *Error) NotImplemented(format string, a ...interface{}) error {
return errors.NotImplemented(e.id, format, a...)
}
func (e *Error) BadGateway(format string, a ...interface{}) error {
return errors.BadGateway(e.id, format, a...)
}
func (e *Error) ServiceUnavailable(format string, a ...interface{}) error {
return errors.ServiceUnavailable(e.id, format, a...)
}
func (e *Error) GatewayTimeout(format string, a ...interface{}) error {
return errors.GatewayTimeout(e.id, format, a...)
}