Skip to content
Merged
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
6 changes: 6 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ func (e *AsertoError) WithHTTPStatus(httpStatus int) *AsertoError {
// and if there are details from multiple errors, the aserto error will be constructed based on the first one.
func FromGRPCStatus(grpcStatus status.Status) *AsertoError {
var result *AsertoError

if len(grpcStatus.Details()) == 0 {
return ErrUnknown.Msg(grpcStatus.Message())
}

for _, detail := range grpcStatus.Details() {
if t, ok := detail.(*errdetails.ErrorInfo); ok {
result = asertoErrors[t.Domain]
Expand All @@ -283,6 +288,7 @@ func FromGRPCStatus(grpcStatus status.Status) *AsertoError {
break
}
}

return result
}

Expand Down