Skip to content

feat(api): manual updates #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ import (
)

type Error = apierror.Error
type ErrorCode = apierror.ErrorCode

const ErrorCodeCanceled = apierror.ErrorCodeCanceled
const ErrorCodeUnknown = apierror.ErrorCodeUnknown
const ErrorCodeInvalidArgument = apierror.ErrorCodeInvalidArgument
const ErrorCodeDeadlineExceeded = apierror.ErrorCodeDeadlineExceeded
const ErrorCodeNotFound = apierror.ErrorCodeNotFound
const ErrorCodeAlreadyExists = apierror.ErrorCodeAlreadyExists
const ErrorCodePermissionDenied = apierror.ErrorCodePermissionDenied
const ErrorCodeResourceExhausted = apierror.ErrorCodeResourceExhausted
const ErrorCodeFailedPrecondition = apierror.ErrorCodeFailedPrecondition
const ErrorCodeAborted = apierror.ErrorCodeAborted
const ErrorCodeOutOfRange = apierror.ErrorCodeOutOfRange
const ErrorCodeUnimplemented = apierror.ErrorCodeUnimplemented
const ErrorCodeInternal = apierror.ErrorCodeInternal
const ErrorCodeUnavailable = apierror.ErrorCodeUnavailable
const ErrorCodeDataLoss = apierror.ErrorCodeDataLoss
const ErrorCodeUnauthenticated = apierror.ErrorCodeUnauthenticated

type ArbitraryData = apierror.ArbitraryData
type ArbitraryDataDebug = apierror.ArbitraryDataDebug
type ArbitraryDataType = apierror.ArbitraryDataType
type ArbitraryDataValue = apierror.ArbitraryDataValue
type ArbitraryData = apierror.ArbitraryData

// An AutomationTrigger represents a trigger for an automation action. The
// `post_environment_start` field indicates that the automation should be triggered
Expand Down
24 changes: 20 additions & 4 deletions internal/apierror/apierror.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,36 @@ import (
"net/http/httputil"

"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/shared"
)

// Error represents an error that originates from the API, i.e. when a request is
// made and the API returns a response with a HTTP status code. Other errors are
// not wrapped by this SDK.
type Error struct {
JSON errorJSON `json:"-"`
StatusCode int
Request *http.Request
Response *http.Response
// The status code, which should be an enum value of
// [google.rpc.Code][google.rpc.Code].
Code shared.ErrorCode `json:"code"`
// Contains an arbitrary serialized message along with a @type that describes the
// type of the serialized message.
Detail shared.ArbitraryData `json:"detail"`
// A developer-facing error message, which should be in English. Any user-facing
// error message should be localized and sent in the
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized by
// the client.
Message string `json:"message"`
ExtraFields map[string]interface{} `json:"-,extras"`
JSON errorJSON `json:"-"`
StatusCode int
Request *http.Request
Response *http.Response
}

// errorJSON contains the JSON metadata for the struct [Error]
type errorJSON struct {
Code apijson.Field
Detail apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down