use miette::Diagnostic;
use std::io;
use thiserror::Error;
#[derive(Debug, Error, Diagnostic)]
#[non_exhaustive]
pub enum AppError {
#[error("the terminal could not be prepared for the game")]
#[diagnostic(
code(fours::terminal_setup),
help("Start the game from an interactive terminal rather than from a pipe or a script.")
)]
TerminalSetup(#[source] io::Error),
#[error("the game could not be drawn")]
#[diagnostic(code(fours::draw))]
Draw(#[source] io::Error),
#[error("the game could not read your input")]
#[diagnostic(code(fours::input))]
Input(#[source] io::Error),
#[error("the terminal could not be restored")]
#[diagnostic(
code(fours::terminal_restore),
help("Run `reset` if your terminal behaves oddly after this.")
)]
TerminalRestore(#[source] io::Error),
}