Merge pull request #21 from nspcc-dev/fix/get-status-error-even-if-it-is-wrapped

Get status error even if it is wrapped
This commit is contained in:
Evgeniy Kulikov 2019-11-26 14:20:05 +03:00 committed by GitHub
commit ab70f84999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package service
import (
"github.com/nspcc-dev/neofs-proto/internal"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@ -106,7 +107,7 @@ func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error {
// check specific condition:
if err := cond[i](ttl); err != nil {
if st, ok := status.FromError(err); ok {
if st, ok := status.FromError(errors.Cause(err)); ok {
return st.Err()
}