NAME

Game::Sternhalma::Error - what Game::Sternhalma dies with when it is misused

SYNOPSIS

my $game = eval { Game::Sternhalma->new(seats => 5) };
if (ref $@ && $@->isa('Game::Sternhalma::Error')) {
    print $@->code, "\n";                   # bad_layout
    print $@->detail, "\n";                 # five cannot play: ...
}

DESCRIPTION

A move a player may not make is never an exception: "play" in Game::Sternhalma returns a flag. This is for a program that asks for something no game can be made of: five seats, a first seat the game does not have, a cap of nothing, a log that is not a game. It stringifies to a message with where it was thrown.

METHODS

throw

Game::Sternhalma::Error->throw($code, $detail)

Dies with a new error. $code is one of "codes".

code

bad_layout, bad_first, bad_cap, bad_position or bad_log.

detail

What was wrong, in words.

message

The whole message, as the error stringifies.

codes

Every code there is.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)