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
3 changes: 1 addition & 2 deletions Depfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
go:
gotestsum:
importPath: "gotest.tools/gotestsum"
version: "v1.6.2"
golangci-lint:
importPath: "github.com/golangci/golangci-lint/cmd/golangci-lint"
version: "v1.46.2"
version: "v1.46.2"
10 changes: 7 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewAsertoError(code string, statusCode codes.Code, httpCode int, msg string
}

// AsertoError represents a well known error
// coming from an Aserto service
// coming from an Aserto service.
type AsertoError struct {
Code string
StatusCode codes.Code
Expand All @@ -47,10 +47,10 @@ func (e *AsertoError) Data() map[string]string {
}

// SameAs returns true if the provided error is an AsertoError
// and has the same error code
// and has the same error code.
func (e *AsertoError) SameAs(err error) bool {
aErr, ok := err.(*AsertoError)
if !ok {
if err == nil || !ok {
return false
}

Expand Down Expand Up @@ -221,6 +221,10 @@ func (e *AsertoError) Interface(key string, value interface{}) *AsertoError {
}

func (e *AsertoError) Unwrap() error {
if e == nil {
return nil
}

if len(e.errs) > 0 {
return e.errs[len(e.errs)-1]
}
Expand Down