forked from getlago/lago-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.go
More file actions
33 lines (25 loc) · 622 Bytes
/
error.go
File metadata and controls
33 lines (25 loc) · 622 Bytes
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
package lago
import (
"errors"
"net/http"
)
type ErrorCode string
const (
ErrorCodeAlreadyExist ErrorCode = "value_already_exist"
ErrorCodeInvalidValue
)
var ErrorTypeAssert = Error{
Err: errors.New("type assertion failed"),
HTTPStatusCode: http.StatusUnprocessableEntity,
Message: "Type assertion failed",
}
type Error struct {
Err error `json:"-"`
HTTPStatusCode int `json:"status"`
Message string `json:"error"`
ErrorCode string `json:"code"`
ErrorDetail map[string][]string `json:"error_details,omitempty"`
}
func (e ErrorCode) Error() string {
return string(e)
}