Package javatro.core

Class JavatroException

All Implemented Interfaces:
Serializable

public final class JavatroException extends Exception
Custom exception class for handling application-specific errors in the Javatro game. Provides factory methods for creating consistent exceptions with colored error messages.
See Also:
  • Constructor Details

    • JavatroException

      public JavatroException(String message)
      Constructs a JavatroException with a colored error message.
      Parameters:
      message - The error message to display (will be colored red)
    • JavatroException

      public JavatroException(String message, Throwable cause)
      Constructs a JavatroException with colored message and cause.
      Parameters:
      message - The error message to display (colored red)
      cause - The underlying cause of the exception
  • Method Details

    • invalidPlayedHand

      public static JavatroException invalidPlayedHand(int minCards, int maxCards)
      Creates exception for invalid number of cards in a poker hand.
      Parameters:
      minCards - Minimum allowed cards
      maxCards - Maximum allowed cards
      Returns:
      Configured exception instance
    • invalidPlaysPerRound

      public static JavatroException invalidPlaysPerRound()
      Returns:
      Exception for invalid plays per round configuration
    • invalidBlindScore

      public static JavatroException invalidBlindScore()
      Returns:
      Exception for invalid blind score input
    • invalidDeck

      public static JavatroException invalidDeck()
      Returns:
      Exception for null deck configuration
    • noCardsRemaining

      public static JavatroException noCardsRemaining()
      Creates an exception indicating the deck is empty.

      This exception is thrown when all the cards in the deck have been drawn.

      Returns:
      A JavatroException indicating the deck is empty.
    • noPlaysRemaining

      public static JavatroException noPlaysRemaining()
      Creates an exception indicating no plays remaining.

      This exception is thrown when the user tries to play cards when no plays are remaining.

      Returns:
      A JavatroException indicating that no plays are remaining.
    • invalidCardInput

      public static JavatroException invalidCardInput()
      Returns:
      Exception for invalid card selection input
    • exceedsMaxCardSelection

      public static JavatroException exceedsMaxCardSelection(int maxCardsToSelect)
      Creates exception for exceeding maximum card selection.
      Parameters:
      maxCardsToSelect - Maximum allowed cards
      Returns:
      Configured exception instance
    • invalidMenuInput

      public static JavatroException invalidMenuInput(int maxRange)
      Creates exception for invalid menu input range.
      Parameters:
      maxRange - Maximum valid input value
      Returns:
      Configured exception instance
    • invalidInputType

      public static JavatroException invalidInputType()
      Returns:
      Exception for non-numeric input where number expected
    • invalidOptionsTitle

      public static JavatroException invalidOptionsTitle()
      Returns:
      Exception for missing or empty options title
    • invalidOptionsSize

      public static JavatroException invalidOptionsSize()
      Returns:
      Exception for invalid options list size
    • invalidScreen

      public static JavatroException invalidScreen()
      Returns:
      Exception for null screen reference
    • indexOutOfBounds

      public static JavatroException indexOutOfBounds(int index)
      Creates exception for index out of bounds.
      Parameters:
      index - Invalid index that was accessed
      Returns:
      Configured exception instance
    • errorLoadingLogo

      public static JavatroException errorLoadingLogo(String fileName)
      Creates exception for missing resource file.
      Parameters:
      fileName - Name of missing file
      Returns:
      Configured exception instance
    • invalidSelectionLimit

      public static JavatroException invalidSelectionLimit()
      Returns:
      Exception for invalid selection limit
    • noRemainingDiscards

      public static JavatroException noRemainingDiscards()
      Returns:
      Exception when no discards remain
    • tooManyDiscards

      public static JavatroException tooManyDiscards()
      Returns:
      Exception for exceeding discard limit
    • cannotDiscardZeroCards

      public static JavatroException cannotDiscardZeroCards()
      Returns:
      Exception for attempting zero discards
    • exceedsMaxJokers

      public static JavatroException exceedsMaxJokers()
      Returns:
      Exception for exceeding maximum joker limit