Skip to content

Commit 5ee2aec

Browse files
authored
Add error handling for error details extraction failure (#35)
1 parent 70f7491 commit 5ee2aec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

serviceerror/convert.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ func FromStatus(st *status.Status) error {
8989

9090
// Extract error details once to optimize performance.
9191
errDetails := extractErrorDetails(st)
92+
93+
// If there was an error during details extraction, it will go to errDetails.
94+
if err, ok := errDetails.(error); ok{
95+
return NewInvalidArgument(err.Error())
96+
}
97+
9298
switch st.Code() {
9399
case codes.NotFound:
94100
if errDetails == nil{

0 commit comments

Comments
 (0)