Documentation
¶
Overview ¶
Package api provides shared API infrastructure (errors, validation interface) used across all API versions. Version-specific types live in sub-packages (e.g. api/v1).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// Status is the HTTP status code.
Status int
// Code is the machine-readable error code.
Code ErrorCode
// Message is the client-facing error message.
Message string
// Details holds optional unstructured diagnostics.
Details map[string]any
// Cause is the optional underlying error.
Cause error
}
Error is a concrete error type with status code, error code, optional details, and optional wrapped error.
type ErrorCode ¶
type ErrorCode string
ErrorCode is a machine-readable error identifier.
const ( CodeBadRequest ErrorCode = "BAD_REQUEST" CodeUnknownHarness ErrorCode = "UNKNOWN_HARNESS" CodeUnknownRepository ErrorCode = "UNKNOWN_REPOSITORY" CodeUnsupportedModel ErrorCode = "UNSUPPORTED_MODEL" CodeInvalidOAuthState ErrorCode = "INVALID_OAUTH_STATE" CodeOAuthGrantNotFound ErrorCode = "OAUTH_GRANT_NOT_FOUND" CodeRepositoryPathConflict ErrorCode = "REPOSITORY_PATH_CONFLICT" CodeUnknownCache ErrorCode = "UNKNOWN_CACHE" CodeUnknownRuntime ErrorCode = "UNKNOWN_RUNTIME" CodeUpdateCheckFailed ErrorCode = "UPDATE_CHECK_FAILED" CodeForbidden ErrorCode = "FORBIDDEN" CodeNotFound ErrorCode = "NOT_FOUND" CodeConflict ErrorCode = "CONFLICT" CodeInternalError ErrorCode = "INTERNAL_ERROR" )
Error codes.
type ErrorDetails ¶
ErrorDetails holds the code and message within an error response.
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorDetails `json:"error"`
Details map[string]any `json:"details,omitempty"`
}
ErrorResponse is the JSON envelope for error responses.
type Validatable ¶
type Validatable interface {
Validate() error
}
Validatable is implemented by request types that can validate their fields.
Click to show internal directories.
Click to hide internal directories.