File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments