Skip to content

Commit 546c191

Browse files
committed
apitypes: add APIError
1 parent f5c66b9 commit 546c191

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

apitypes/apitypes.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ package apitypes
88

99
// Port is the listening port of the HTTP API server.
1010
const Port = "1314"
11+
12+
// APIError is the body returned by the Contrast HTTP API if a request was not successful.
13+
type APIError struct {
14+
// Version is the Coordinator version.
15+
Version string `json:"version"`
16+
StatusCode int `json:"status_code"`
17+
Err string `json:"error"`
18+
}

apitypes/attest.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ type AttestationRequest struct {
2222
}
2323

2424
// AttestationError is returned by the /attest endpoint if the request was not successful.
25-
type AttestationError struct {
26-
// Version is the Coordinator version.
27-
Version string `json:"version"`
28-
Err string `json:"error"`
29-
}
25+
//
26+
// It is an alias of [APIError], which all Contrast HTTP API endpoints return on error.
27+
type AttestationError = APIError
3028

3129
// AttestationResponse contains all fields required for application-level verification.
3230
type AttestationResponse struct {

0 commit comments

Comments
 (0)