Introduce custom errors for player handling

Custom errors for malformed/nonexistent player IDs as well as a player
not having a high enough balance for the money requested.

This will allow me to encode more information in the errors, for
callers to use.  I'm generally of the opinion that callers should be
checking error conditions before calling these functions, but per
Murphy's law it would be nice to have more information in the error
message.
This commit is contained in:
2025-02-15 15:40:56 +00:00
parent 4ded442dd4
commit 24b07f9166
2 changed files with 27 additions and 3 deletions

View File

@@ -55,6 +55,8 @@
(:export
:player
:players
:error-player-nonexistent
:error-player-broke
:player-id :player-balance :player-hand
:player-exists? :player-bankrupt? :player-can-bet?
:player-pay