Skip to content

Commit

Permalink
return NotFound if response error NotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
whywaita committed Dec 9, 2021
1 parent 942494f commit ba52677
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion shoes-lxd-multi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ func (l Client) DeleteInstance(ctx context.Context, req *pb.DeleteInstanceReques
}

if _, err := slClient.DeleteInstance(ctx, slReq); err != nil {
return nil, status.Errorf(codes.Internal, "failed to DeleteInstance: %+v", err)
switch status.Code(err) {
case codes.NotFound:
return nil, status.Errorf(codes.NotFound, "failed to DeleteInstance: %+v", err)
default:
return nil, status.Errorf(codes.Internal, "failed to DeleteInstance: %+v", err)
}
}
return &pb.DeleteInstanceResponse{}, nil
}

0 comments on commit ba52677

Please sign in to comment.