Package-level declarations

Overview

Application-specific exceptions for handling GUI-related errors and user-facing error states.

Exception Types

  • CouldNotLoadAsset — Thrown when audio/visual assets fail to load

  • ErrorMessage — Base exception for user-displayable error messages

  • ExitApp — Exception to signal application exit

  • GameCorrupted — Thrown when loaded game data is corrupted

  • GameIsFull — Thrown when attempting to join a full game

  • GameNotStartedYet — Thrown when operations require an active game

  • NoPieceSelected — Thrown when move requires piece selection

Responsibilities

  • Providing user-friendly error messages

  • Distinguishing recoverable from fatal errors

  • Supporting graceful error handling in the UI

Types

Link copied to clipboard
class CouldNotLoadAsset(message: String = "Could not load asset.", type: ErrorType = ErrorType.WARNING) : ReversiException

Exception thrown when a required text input field is empty.

Link copied to clipboard

Exception thrown to signal that the application should terminate. Used to trigger a clean shutdown of the application.

Link copied to clipboard
class GameCorrupted(message: String = "The game data is corrupted and cannot be loaded.", type: ErrorType = ErrorType.ERROR) : ReversiException

Exception thrown when a saved game file is corrupted or cannot be deserialized.

Link copied to clipboard
class GameIsFull(message: String = "The game is full", type: ErrorType = ErrorType.INFO) : ReversiException

Exception thrown when attempting to join a multiplayer game that already has all players.

Link copied to clipboard
class GameNotStartedYet(message: String = "The game has not started yet", type: ErrorType = ErrorType.WARNING) : ReversiException

Exception thrown when an operation requires an active game that hasn't been started yet.

Link copied to clipboard
class NoPieceSelected(message: String = "No piece selected", type: ErrorType = ErrorType.INFO) : ReversiException

Exception thrown when the user attempts to start a game without selecting a piece color.

Functions

Link copied to clipboard
@Composable
fun ReversiScope.CriticalMessageDialog(error: ReversiException?, modifier: Modifier = Modifier, setError: (Exception?, ErrorType?) -> Unit)
Link copied to clipboard
@Composable
fun ReversiScope.ErrorMessage(error: ReversiException?, modifier: Modifier = Modifier, setError: (Exception?, ErrorType?) -> Unit)

Composable that displays an error message based on the error type.

Link copied to clipboard
@Composable
fun ReversiScope.ErrorMessageDialog(error: ReversiException?, modifier: Modifier = Modifier, setError: (Exception?, ErrorType?) -> Unit)
Link copied to clipboard
@Composable
fun ReversiScope.ToastMessage(error: ReversiException?, modifier: Modifier = Modifier, setError: (Exception?, ErrorType?) -> Unit)

Composable that shows a toast message for errors. The message is displayed for 2 seconds before being cleared.

Link copied to clipboard
@Composable
fun ReversiScope.WarningMessage(error: ReversiException?, modifier: Modifier = Modifier, setError: (Exception?, ErrorType?) -> Unit)