diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cce9240..dbe5ddf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.1" + ".": "0.3.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 55448e2..931167c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.3.2 (2025-02-18) + +Full Changelog: [v0.3.1...v0.3.2](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.1...v0.3.2) + +### Features + +* feat(shared): add standard error codes for API errors ([#45](https://github.com/gitpod-io/gitpod-sdk-go/issues/45)) ([bab81e0](https://github.com/gitpod-io/gitpod-sdk-go/commit/bab81e0dc68c2499dc57faf6ae25f7162da06427)) + ## 0.3.1 (2025-02-18) Full Changelog: [v0.3.0...v0.3.1](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.0...v0.3.1) diff --git a/README.md b/README.md index 5a3b141..4456f9a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.3.1' +go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.3.2' ``` diff --git a/go.mod b/go.mod index b6a18c3..f776218 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,11 @@ module github.com/gitpod-io/gitpod-sdk-go go 1.21 require ( - github.com/google/uuid v1.3.0 // indirect - github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/gjson v1.14.4 + github.com/tidwall/sjson v1.2.5 +) + +require ( github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect - github.com/tidwall/sjson v1.2.5 // indirect ) diff --git a/go.sum b/go.sum index 569e555..a70a5e0 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= diff --git a/internal/apierror/error.go b/internal/apierror/error.go new file mode 100644 index 0000000..cac011e --- /dev/null +++ b/internal/apierror/error.go @@ -0,0 +1,22 @@ +package apierror + +import "github.com/gitpod-io/gitpod-sdk-go/shared" + +type ErrorCode = shared.ErrorCode + +const ErrorCodeCanceled = shared.ErrorCodeCanceled +const ErrorCodeUnknown = shared.ErrorCodeUnknown +const ErrorCodeInvalidArgument = shared.ErrorCodeInvalidArgument +const ErrorCodeDeadlineExceeded = shared.ErrorCodeDeadlineExceeded +const ErrorCodeNotFound = shared.ErrorCodeNotFound +const ErrorCodeAlreadyExists = shared.ErrorCodeAlreadyExists +const ErrorCodePermissionDenied = shared.ErrorCodePermissionDenied +const ErrorCodeResourceExhausted = shared.ErrorCodeResourceExhausted +const ErrorCodeFailedPrecondition = shared.ErrorCodeFailedPrecondition +const ErrorCodeAborted = shared.ErrorCodeAborted +const ErrorCodeOutOfRange = shared.ErrorCodeOutOfRange +const ErrorCodeUnimplemented = shared.ErrorCodeUnimplemented +const ErrorCodeInternal = shared.ErrorCodeInternal +const ErrorCodeUnavailable = shared.ErrorCodeUnavailable +const ErrorCodeDataLoss = shared.ErrorCodeDataLoss +const ErrorCodeUnauthenticated = shared.ErrorCodeUnauthenticated diff --git a/internal/version.go b/internal/version.go index 9e4f81e..6fb829f 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.3.1" // x-release-please-version +const PackageVersion = "0.3.2" // x-release-please-version diff --git a/shared/error.go b/shared/error.go new file mode 100644 index 0000000..8edf8c9 --- /dev/null +++ b/shared/error.go @@ -0,0 +1,22 @@ +package shared + +type ErrorCode string + +const ( + ErrorCodeCanceled ErrorCode = "canceled" + ErrorCodeUnknown ErrorCode = "unknown" + ErrorCodeInvalidArgument ErrorCode = "invalid_argument" + ErrorCodeDeadlineExceeded ErrorCode = "deadline_exceeded" + ErrorCodeNotFound ErrorCode = "not_found" + ErrorCodeAlreadyExists ErrorCode = "already_exists" + ErrorCodePermissionDenied ErrorCode = "permission_denied" + ErrorCodeResourceExhausted ErrorCode = "resource_exhausted" + ErrorCodeFailedPrecondition ErrorCode = "failed_precondition" + ErrorCodeAborted ErrorCode = "aborted" + ErrorCodeOutOfRange ErrorCode = "out_of_range" + ErrorCodeUnimplemented ErrorCode = "unimplemented" + ErrorCodeInternal ErrorCode = "internal" + ErrorCodeUnavailable ErrorCode = "unavailable" + ErrorCodeDataLoss ErrorCode = "data_loss" + ErrorCodeUnauthenticated ErrorCode = "unauthenticated" +)