NAME
Game::Gin::Error - what the rules refuse, as a code
VERSION
Version 0.01
SYNOPSIS
my $out = $game->apply('p1', { kind => 'discard', card => $id });
if (ref $out eq 'Game::Gin::Error') {
$out->code; # 'not_held'
$out->message; # 'that card is not in your hand'
}
DESCRIPTION
The engine returns its refusals rather than throwing them, so a caller decides what its users read. die is reserved for programmer error.
METHODS
new_code
Game::Gin::Error->new_code('not_held');
Builds an error from a code, filling in the message.
code
The short code, which is what a caller should branch on.
message
A sentence, for a terminal.
codes
Every code this class knows, sorted. A caller mapping codes to its own vocabulary can use this to check it has covered them all.
AUTHOR
LNATION, <email@lnation.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under the Artistic License 2.0.