error handling #3

Open
opened 2024-02-15 16:21:34 +01:00 by adriangl · 0 comments
Member

It is currently possible to overflow the values when submitting a move, and the gameserver crashes.

log:

GET /api/game/b6ad6b38-46d4-4aa1-b0dc-f6f215bdd063?player=a:

Matched: (get_game) GET /api/game/?
thread 'rocket-worker-thread' panicked at 'called Result::unwrap() on an Err value: PoisonError { .. }', src/main.rs:29:41
Handler get_game panicked.
This is an application bug.
A panic in Rust must be treated as an exceptional event.
Panicking is not a suitable error handling mechanism.
Unwinding, the result of a panic, is an expensive operation.
Panics will degrade application performance.
Instead of panicking, return Option and/or Result.
Values of either type can be returned directly from handlers.
A panic is treated as an internal server error.
Outcome: Error(500 Internal Server Error)
No 500 catcher registered. Using Rocket default.
Response succeeded.

submitted move

{'player': 'a', 'policy': 'strict', 'color': 'blue', 'source': 5, 'destination': 0}

It is currently possible to overflow the values when submitting a move, and the gameserver crashes. log: GET /api/game/b6ad6b38-46d4-4aa1-b0dc-f6f215bdd063?player=a: >> Matched: (get_game) GET /api/game/<id>?<player> thread 'rocket-worker-thread' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', src/main.rs:29:41 >> Handler get_game panicked. >> This is an application bug. >> A panic in Rust must be treated as an exceptional event. >> Panicking is not a suitable error handling mechanism. >> Unwinding, the result of a panic, is an expensive operation. >> Panics will degrade application performance. >> Instead of panicking, return `Option` and/or `Result`. >> Values of either type can be returned directly from handlers. >> A panic is treated as an internal server error. >> Outcome: Error(500 Internal Server Error) >> No 500 catcher registered. Using Rocket default. >> Response succeeded. submitted move {'player': 'a', 'policy': 'strict', 'color': 'blue', 'source': 5, 'destination': 0}
Sign in to join this conversation.
No description provided.