atlasgames-repo / fortress-defense

The unity fortress defense project
8 stars 0 forks source link

Error with API manager status #29

Closed m-nt closed 1 year ago

m-nt commented 1 year ago

How to re-produce the error:

In this current commit 7b21f6be586dce9d557db06b636cc8109a9ee309 if the server gets error and sends 500 error the game status in API manager gets error.

Errors:

1

NullReferenceException: Object reference not set to an instance of an object
APIManager+<RunStatus>d__18.MoveNext () (at Assets/Atlas games/Scripts/APIManager.cs:54)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <31d5d65b32ec483292e13e8ae4100b93>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

2

WebException: HTTP/1.1 500 Internal Server Error
APIManager+<Get>d__32`1[T].MoveNext () (at Assets/Atlas games/Scripts/APIManager.cs:216)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
APIManager+<Check_for_updates>d__22.MoveNext () (at Assets/Atlas games/Scripts/APIManager.cs:84)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
AssetBundleManager+<LoadFromFile>d__3.MoveNext () (at Assets/Atlas games/Scripts/AssetBundleManager.cs:33)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
AssetBundleManager+<LoadDownloadedAssets>d__2.MoveNext () (at Assets/Atlas games/Scripts/AssetBundleManager.cs:29)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
AssetBundleManager+<Awake>d__1.MoveNext () (at Assets/Atlas games/Scripts/AssetBundleManager.cs:18)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <31d5d65b32ec483292e13e8ae4100b93>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

3 Server error

INFO:     127.0.0.1:63372 - "GET /updates?type=stories HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\fastapi\applications.py", line 290, in __call__
    await super().__call__(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in __call__
    raise e
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\fastapi\routing.py", line 241, in app
    raw_response = await run_endpoint_function(
  File "D:\Projects\Hadi\StaticFileTest\.venv\lib\site-packages\fastapi\routing.py", line 167, in run_endpoint_function
    return await dependant.call(**values)
  File "D:\Projects\Hadi\StaticFileTest\app.py", line 71, in check_for_updates
    return {"list": [f"{base_url}{type}{list[type]}.assetbundle"]}
KeyError: 'stories'
INFO:     127.0.0.1:63374 - "GET /updates?type=menuhomemenu HTTP/1.1" 200 OK

How to solve this Error (suggestion)