Skip to content

Commit 3078f81

Browse files
committed
feat: debug e2e failing
1 parent 4394792 commit 3078f81

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

cmd/processor/handler.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,29 @@ func (h *processorHandler) processAllocation(req *allocationpb.AllocationRequest
239239

240240
resultObj, err := h.allocator.Allocate(h.ctx, gsa)
241241
if err != nil {
242-
return allocationResult{
243-
error: &rpcstatus.Status{
244-
Code: int32(codes.Internal),
245-
Message: fmt.Sprintf("Allocator error: %v", err),
242+
unallocated := &allocationv1.GameServerAllocation{
243+
Spec: gsa.Spec,
244+
Status: allocationv1.GameServerAllocationStatus{
245+
State: allocationv1.GameServerAllocationUnAllocated,
246246
},
247247
}
248+
response, convErr := converters.ConvertGSAToAllocationResponse(unallocated, h.grpcUnallocatedStatusCode)
249+
if convErr != nil {
250+
grpcStatus, ok := status.FromError(convErr)
251+
code := h.grpcUnallocatedStatusCode
252+
msg := convErr.Error()
253+
if ok {
254+
code = grpcStatus.Code()
255+
msg = grpcStatus.Message()
256+
}
257+
return allocationResult{
258+
error: &rpcstatus.Status{
259+
Code: int32(code),
260+
Message: msg,
261+
},
262+
}
263+
}
264+
return allocationResult{response: response}
248265
}
249266

250267
if s, ok := resultObj.(*metav1.Status); ok {

0 commit comments

Comments
 (0)