1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum SolError {
5 #[error("Invalid number of decks: {0}. Must be 1 or 2")]
6 InvalidDeckNumber(u8),
7 #[error("Invalid number of temporary slots: {0}. Must be between 0 and 4")]
8 InvalidTempNumber(u8),
9 #[error("Invalid number of columns: {0}. Must be between 1 and 10")]
10 InvalidColNumber(u8),
11 #[error("Invalid number of dealt cards at a time: {0}. Must be between 1 and 16")]
12 InvalidDealBy(u8),
13 #[error("Invalid number of redeals: {0}")]
14 InvalidRedeals(i8),
15 #[error("No foundation defined")]
16 NoFoundation,
17 #[error("Foundation cannot start with EMPTY card face")]
18 NoFoundationStart,
19 #[error("No columns defined")]
20 NoCols,
21 #[error("Insufficient cards in the deck for {0}")]
22 InsufficientFor(String),
23 #[error("Pile is disabled but a few cards are still in the deck")]
24 UnusedCards,
25 #[error("Invalid location")]
26 InvalidLocation,
27 #[error("Invalid destination")]
28 InvalidDestination,
29 #[error("Invalid move")]
30 InvalidMove,
31 #[error("Card cannot be moved")]
32 Unplayable,
33 #[error("No card selected")]
34 NotSelected,
35 #[error("Card cannot be played")]
36 NoDestination,
37 #[error("Invalid card suit: {0}")]
38 InvalidSuit(String),
39 #[error("Invalid card face: {0}")]
40 InvalidFace(String),
41 #[error("Invalid card suit order: {0}")]
42 InvalidSuitOrder(String),
43 #[error("Invalid card face order: {0}")]
44 InvalidFaceOrder(String),
45 #[error("Solitaire list is empty")]
46 SolitaireListEmpty,
47 #[error("Solitaire {0} does not exist")]
48 SolitaireNotExist(String),
49
50 #[error("Invalid configuration line: {0}")]
51 InvalidConfLine(String),
52 #[error("Invalid configuration section {0}")]
53 InvalidConfSection(String),
54 #[error("Invalid configuration option {1} of section {0}")]
55 InvalidConfOption(String, String),
56 #[error("Invalid configuration value {1} for option {0}")]
57 InvalidConfOptionValue(String, String),
58 #[error("Invalid configuration: limit for a temp slot must be set if temp is refillable")]
59 InvalidConfTempLimit,
60 #[error("Invalid configuration: refillable temp slot must define sort order for card face and/or for card suit")]
61 InvalidConfTempOrder,
62 #[error("Invalid temp configuration: only one slot can be refillable")]
63 InvalidConfTempSingleRefillable,
64 #[error("File does not exist")]
65 InvalidFileName,
66 #[error("Reading rules from file failed")]
67 FailedToOpenRules,
68
69 #[error("Invalid terminal size {0}x{1} (must be at least 60x25)")]
70 InvalidTermSize(u16, u16),
71
72 #[error("{0}")]
73 Unexpected(String), #[error("{0} unsupported yet")]
75 Unsupported(String),
76}