Skip to content

Commit fd32111

Browse files
Return empty NotFound when Details/Failure is nil (#20)
1 parent d6f5d8f commit fd32111

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

serviceerror/convert.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ func FromStatus(st *status.Status) error {
9191
f := extractFailure(st)
9292
switch st.Code() {
9393
case codes.NotFound:
94-
return newNotFound(st, f.(*failure.NotFound))
94+
if f == nil{
95+
return newNotFound(st, nil)
96+
}
97+
switch f := f.(type) {
98+
case *failure.NotFound:
99+
return newNotFound(st, f)
100+
}
95101
case codes.InvalidArgument:
96102
if f == nil {
97103
return newInvalidArgument(st)

0 commit comments

Comments
 (0)