Skip to content
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
8 changes: 8 additions & 0 deletions serviceerror/aborted.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -47,3 +48,10 @@ func newAborted(st *status.Status) error {
st: st,
}
}

// IsAborted returns whether any error in the provided error's chain is an
// Aborted error.
func IsAborted(err error) bool {
var serr *Aborted
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/already_exists.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -53,3 +54,10 @@ func newAlreadyExists(st *status.Status) error {
st: st,
}
}

// IsAlreadyExists returns whether any error in the provided error's chain is an
// AlreadyExists error.
func IsAlreadyExists(err error) bool {
var serr *AlreadyExists
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/canceled.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newCanceled(st *status.Status) error {
st: st,
}
}

// IsCanceled returns whether any error in the provided error's chain is a
// Canceled error.
func IsCanceled(err error) bool {
var serr *Canceled
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/cancellation_already_requested.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -54,3 +55,10 @@ func newCancellationAlreadyRequested(st *status.Status) error {
st: st,
}
}

// IsCancellationAlreadyRequested returns whether any error in the provided error's chain is a
// CancellationAlreadyRequested error.
func IsCancellationAlreadyRequested(err error) bool {
var serr *CancellationAlreadyRequested
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/client_version_not_supported.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -70,3 +71,10 @@ func newClientVersionNotSupported(st *status.Status, errDetails *errordetails.Cl
st: st,
}
}

// IsClientVersionNotSupported returns whether any error in the provided error's chain is a
// ClientVersionNotSupported error.
func IsClientVersionNotSupported(err error) bool {
var serr *ClientVersionNotSupported
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/data_loss.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newDataLoss(st *status.Status) error {
st: st,
}
}

// IsDataLoss returns whether any error in the provided error's chain is a
// DataLoss error.
func IsDataLoss(err error) bool {
var serr *DataLoss
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/deadline_exceeded.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newDeadlineExceeded(st *status.Status) error {
st: st,
}
}

// IsDeadlineExceeded returns whether any error in the provided error's chain is a
// DeadlineExceeded error.
func IsDeadlineExceeded(err error) bool {
var serr *DeadlineExceeded
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/failed_precondition.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newFailedPrecondition(st *status.Status) error {
st: st,
}
}

// IsFailedPrecondition returns whether any error in the provided error's chain is a
// FailedPrecondition error.
func IsFailedPrecondition(err error) bool {
var serr *FailedPrecondition
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/internal.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newInternal(st *status.Status) error {
st: st,
}
}

// IsInternal returns whether any error in the provided error's chain is an
// Internal error.
func IsInternal(err error) bool {
var serr *Internal
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/invalid_argument.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -48,3 +49,10 @@ func newInvalidArgument(st *status.Status) error {
st: st,
}
}

// IsInvalidArgument returns whether any error in the provided error's chain is an
// InvalidArgument error.
func IsInvalidArgument(err error) bool {
var serr *InvalidArgument
return errors.As(err, &serr)
}
7 changes: 7 additions & 0 deletions serviceerror/multi_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ func newMultiOperationExecution(st *status.Status, errs []error) error {
st: st,
}
}

// IsMultiOperationExecution returns whether any error in the provided error's chain is a
// MultiOperationExecution error.
func IsMultiOperationExecution(err error) bool {
var serr *MultiOperationExecution
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/multi_op_aborted.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

failurepb "go.temporal.io/api/failure/v1"
Expand Down Expand Up @@ -49,3 +50,10 @@ func newMultiOperationAborted(st *status.Status) error {
st: st,
}
}

// IsMultiOperationAborted returns whether any error in the provided error's chain is a
// MultiOperationAborted error.
func IsMultiOperationAborted(err error) bool {
var serr *MultiOperationAborted
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/namespace_already_exists.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -54,3 +55,10 @@ func newNamespaceAlreadyExists(st *status.Status) error {
st: st,
}
}

// IsNamespaceAlreadyExists returns whether any error in the provided error's chain is a
// NamespaceAlreadyExists error.
func IsNamespaceAlreadyExists(err error) bool {
var serr *NamespaceAlreadyExists
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/namespace_invalid_state.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -70,3 +71,10 @@ func newNamespaceInvalidState(st *status.Status, errDetails *errordetails.Namesp
st: st,
}
}

// IsNamespaceInvalidState returns whether any error in the provided error's chain is a
// NamespaceInvalidState error.
func IsNamespaceInvalidState(err error) bool {
var serr *NamespaceInvalidState
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/namespace_not_active.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -65,3 +66,10 @@ func newNamespaceNotActive(st *status.Status, errDetails *errordetails.Namespace
st: st,
}
}

// IsNamespaceNotActive returns whether any error in the provided error's chain is a
// NamespaceNotActive error.
func IsNamespaceNotActive(err error) bool {
var serr *NamespaceNotActive
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/namespace_not_found.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -55,3 +56,10 @@ func newNamespaceNotFound(st *status.Status, errDetails *errordetails.NamespaceN
st: st,
}
}

// IsNamespaceNotFound returns whether any error in the provided error's chain is a
// NamespaceNotFound error.
func IsNamespaceNotFound(err error) bool {
var serr *NamespaceNotFound
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/namespace_unavailable.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -57,3 +58,10 @@ func newNamespaceUnavailable(st *status.Status, errDetails *errordetails.Namespa
Namespace: errDetails.GetNamespace(),
}
}

// IsNamespaceUnavailable returns whether any error in the provided error's chain is a
// NamespaceUnavailable error.
func IsNamespaceUnavailable(err error) bool {
var serr *NamespaceUnavailable
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/newer_build_exists.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -53,3 +54,10 @@ func newNewerBuildExists(st *status.Status, errDetails *errordetails.NewerBuildE
st: st,
}
}

// IsNewerBuildExists returns whether any error in the provided error's chain is a
// NewerBuildExists error.
func IsNewerBuildExists(err error) bool {
var serr *NewerBuildExists
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/not_found.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -61,3 +62,10 @@ func newNotFound(st *status.Status, errDetails *errordetails.NotFoundFailure) er
st: st,
}
}

// IsNotFound returns whether any error in the provided error's chain is a
// NotFound error.
func IsNotFound(err error) bool {
var serr *NotFound
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/permission_denied.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"go.temporal.io/api/errordetails/v1"
Expand Down Expand Up @@ -59,3 +60,10 @@ func newPermissionDenied(st *status.Status, errDetails *errordetails.PermissionD
st: st,
}
}

// IsPermissionDenied returns whether any error in the provided error's chain is a
// PermissionDenied error.
func IsPermissionDenied(err error) bool {
var serr *PermissionDenied
return errors.As(err, &serr)
}
8 changes: 8 additions & 0 deletions serviceerror/query_failed.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package serviceerror

import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -76,3 +77,10 @@ func newQueryFailed(st *status.Status, errDetails *errordetails.QueryFailedFailu
st: st,
}
}

// IsQueryFailed returns whether any error in the provided error's chain is a
// QueryFailed error.
func IsQueryFailed(err error) bool {
var serr *QueryFailed
return errors.As(err, &serr)
}
Loading