-
Notifications
You must be signed in to change notification settings - Fork 21
/
errors.go
32 lines (28 loc) · 951 Bytes
/
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
package routing_api
type Type string
type Error struct {
Type Type `json:"name"`
Message string `json:"message"`
}
func (err Error) Error() string {
return err.Message
}
func NewError(errType Type, message string) Error {
return Error{
Type: errType,
Message: message,
}
}
const (
ResponseError Type = "ResponseError"
ResourceNotFoundError Type = "ResourceNotFoundError"
ProcessRequestError Type = "ProcessRequestError"
RouteInvalidError Type = "RouteInvalidError"
RouteServiceUrlInvalidError Type = "RouteServiceUrlInvalidError"
DBCommunicationError Type = "DBCommunicationError"
GuidGenerationError Type = "GuidGenerationError"
UnauthorizedError Type = "UnauthorizedError"
TcpRouteMappingInvalidError Type = "TcpRouteMappingInvalidError"
DBConflictError Type = "DBConflictError"
PortRangeExhaustedError Type = "PortRangeExhaustedError"
)