|
|
@ -131,20 +131,20 @@ func FromError(err error) *Error { |
|
|
|
return se |
|
|
|
return se |
|
|
|
} |
|
|
|
} |
|
|
|
gs, ok := status.FromError(err) |
|
|
|
gs, ok := status.FromError(err) |
|
|
|
if ok { |
|
|
|
if !ok { |
|
|
|
ret := New( |
|
|
|
return New(UnknownCode, UnknownReason, err.Error()) |
|
|
|
httpstatus.FromGRPCCode(gs.Code()), |
|
|
|
} |
|
|
|
UnknownReason, |
|
|
|
ret := New( |
|
|
|
gs.Message(), |
|
|
|
httpstatus.FromGRPCCode(gs.Code()), |
|
|
|
) |
|
|
|
UnknownReason, |
|
|
|
for _, detail := range gs.Details() { |
|
|
|
gs.Message(), |
|
|
|
switch d := detail.(type) { |
|
|
|
) |
|
|
|
case *errdetails.ErrorInfo: |
|
|
|
for _, detail := range gs.Details() { |
|
|
|
ret.Reason = d.Reason |
|
|
|
switch d := detail.(type) { |
|
|
|
return ret.WithMetadata(d.Metadata) |
|
|
|
case *errdetails.ErrorInfo: |
|
|
|
} |
|
|
|
ret.Reason = d.Reason |
|
|
|
|
|
|
|
return ret.WithMetadata(d.Metadata) |
|
|
|
} |
|
|
|
} |
|
|
|
return ret |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return New(UnknownCode, UnknownReason, err.Error()) |
|
|
|
return ret |
|
|
|
} |
|
|
|
} |
|
|
|