/
errors.go
67 lines (54 loc) · 1.72 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
// Copyright 2017-2018, Square, Inc.
package api
import (
"net/http"
"github.com/square/etre"
)
// These are default API-level error responses that should not be modified.
// See api.go for how they're used. The API writes them back to clients. It
// uses the fields to create a custom etre.Error and set the HTTP status code.
var ErrDuplicateEntity = etre.Error{
Type: "duplicate-entity",
HTTPStatus: http.StatusConflict,
Message: "cannot insert or update entity because identifying labels conflict with another entity",
}
var ErrNotFound = etre.Error{
Type: "entity-not-found",
HTTPStatus: http.StatusNotFound,
Message: "entity not found",
}
var ErrMissingParam = etre.Error{
Type: "missing-param",
HTTPStatus: http.StatusBadRequest,
Message: "missing parameter",
}
var ErrInvalidParam = etre.Error{
Type: "invalid-param",
HTTPStatus: http.StatusBadRequest,
Message: "missing parameter",
}
var ErrInvalidQuery = etre.Error{
Type: "invalid-query",
HTTPStatus: http.StatusBadRequest,
Message: "invalid query",
}
var ErrInternal = etre.Error{
Type: "internal-error",
HTTPStatus: http.StatusInternalServerError,
Message: "internal server error",
}
var ErrCDCDisabled = etre.Error{
Type: "cdc-disabled",
HTTPStatus: http.StatusNotImplemented,
Message: "CDC disabled",
}
var ErrNoContent = etre.Error{
Message: "no entities provided (PUT or POST with zero-length HTTP payload or JSON array)",
Type: "no-content",
HTTPStatus: http.StatusBadRequest,
}
var ErrInvalidContent = etre.Error{
Message: "HTTP payload is not valid JSON: []etre.Entity for POST or etre.Entity for PUT",
Type: "invalid-content",
HTTPStatus: http.StatusBadRequest,
}