Skip to content

Commit

Permalink
Merge pull request #131258 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.1.5-rc-131215

release-24.1.5-rc: sql/colexecerror: implement `Unwrap` on `StorageError`, deflake `TestAdminDecommissionedOperations`
  • Loading branch information
celiala authored Sep 23, 2024
2 parents 67bfc35 + 1b5fc16 commit f3ff8fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/server/storage_api/decommission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ func TestAdminDecommissionedOperations(t *testing.T) {
})
return err
}},
{"Events", codes.Internal, func(ctx context.Context, c serverpb.AdminClient) error {
{"Events", codes.PermissionDenied, func(ctx context.Context, c serverpb.AdminClient) error {
_, err := c.Events(ctx, &serverpb.EventsRequest{})
return err
}},
Expand Down
11 changes: 5 additions & 6 deletions pkg/sql/colexecerror/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,17 @@ func shouldCatchPanic(panicEmittedFrom string) bool {
// stack, such as the network or storage layers. A StorageError will be bubbled
// up all the way past the SQL layer unchanged.
type StorageError struct {
error
cause error
}

// Cause implements the Causer interface.
func (s *StorageError) Cause() error {
return s.error
}
func (s *StorageError) Error() string { return s.cause.Error() }
func (s *StorageError) Cause() error { return s.cause }
func (s *StorageError) Unwrap() error { return s.cause }

// NewStorageError returns a new storage error. This can be used to propagate
// an error through the exec subsystem unchanged.
func NewStorageError(err error) *StorageError {
return &StorageError{error: err}
return &StorageError{cause: err}
}

// notInternalError is an error that occurs not because the vectorized engine
Expand Down

0 comments on commit f3ff8fb

Please sign in to comment.