-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy patherrors.go
38 lines (29 loc) · 791 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
33
34
35
36
37
38
package godata
type GoDataError struct {
ResponseCode int
Message string
}
func (err *GoDataError) Error() string {
return err.Message
}
func BadRequestError(message string) *GoDataError {
return &GoDataError{400, message}
}
func NotFoundError(message string) *GoDataError {
return &GoDataError{404, message}
}
func MethodNotAllowedError(message string) *GoDataError {
return &GoDataError{405, message}
}
func GoneError(message string) *GoDataError {
return &GoDataError{410, message}
}
func PreconditionFailedError(message string) *GoDataError {
return &GoDataError{412, message}
}
func InternalServerError(message string) *GoDataError {
return &GoDataError{500, message}
}
func NotImplementedError(message string) *GoDataError {
return &GoDataError{501, message}
}