Class AmadeusException
- All Implemented Interfaces:
Serializable
This class extends Exception and provides static factory methods to create
exceptions for different error scenarios, such as invalid commands, missing arguments,
invalid task formats, and database errors.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAmadeusException(String message) Constructs anAmadeusExceptionwith a specified error message. -
Method Summary
Modifier and TypeMethodDescriptionstatic AmadeusExceptionerrorLoadingTask(String file) Creates an exception for errors while loading tasks from the file.static AmadeusExceptionerrorParsingTask(String line) Creates an exception for errors while parsing a task from the saved file.static AmadeusExceptionerrorSavingTask(String file) Creates an exception for errors while saving tasks to the file.static AmadeusExceptionCreates an exception indicating an invalid check command format.static AmadeusExceptionCreates an exception indicating an invalid command was entered.static AmadeusExceptionCreates an exception indicating an invalid date format.static AmadeusExceptionCreates an exception indicating an invalid deadline format.static AmadeusExceptionCreates an exception indicating an invalid event format.static AmadeusExceptionCreates an exception indicating an invalid event time range.static AmadeusExceptionCreates an exception indicating an out-of-bounds task index.static AmadeusExceptionCreates an exception indicating an invalid task index format.static AmadeusExceptioninvalidTaskType(String type) Creates an exception for an unrecognized task type found in the saved file.static AmadeusExceptionmissingArgument(String type) Creates an exception indicating a required argument is missing.static AmadeusExceptionCreates an exception indicating a missing task index.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AmadeusException
Constructs anAmadeusExceptionwith a specified error message.- Parameters:
message- The detailed error message explaining the exception.
-
-
Method Details
-
invalidCommand
Creates an exception indicating an invalid command was entered.This exception is thrown when the user inputs a command that is not recognized by the application.
- Returns:
- An
AmadeusExceptionwith a message prompting the user to view available commands.
-
missingArgument
Creates an exception indicating a required argument is missing.This exception is thrown when the user fails to provide a necessary argument, such as a task description.
- Parameters:
type- The type of task (e.g., "todo", "deadline", "event") for which the argument is missing.- Returns:
- An
AmadeusExceptionindicating the missing argument.
-
invalidDeadline
Creates an exception indicating an invalid deadline format.This exception is thrown when the user enters a deadline task with an incorrect format.
- Returns:
- An
AmadeusExceptionindicating the correct deadline format.
-
invalidEvent
Creates an exception indicating an invalid event format.This exception is thrown when the user enters an event task with an incorrect format.
- Returns:
- An
AmadeusExceptionindicating the correct event format.
-
invalidEventTime
Creates an exception indicating an invalid event time range.This exception is thrown when the event's start time is after its end time.
- Returns:
- An
AmadeusExceptionindicating that the event time range is invalid.
-
invalidCheck
Creates an exception indicating an invalid check command format.This exception is thrown when the user enters a check command with an incorrect format.
- Returns:
- An
AmadeusExceptionindicating the correct check command format.
-
missingNumber
Creates an exception indicating a missing task index.This exception is thrown when the user does not provide an index for commands like `mark`, `unmark`, or `delete`.
- Returns:
- An
AmadeusExceptionprompting the user to provide a task index.
-
invalidNumber
Creates an exception indicating an invalid task index format.This exception is thrown when the user provides an index that is not a valid number.
- Returns:
- An
AmadeusExceptionprompting the user to provide a valid numeric task index.
-
invalidIndex
Creates an exception indicating an out-of-bounds task index.This exception is thrown when the user provides an index that is outside the range of the task list.
- Returns:
- An
AmadeusExceptionindicating that the task index was not found.
-
invalidDate
Creates an exception indicating an invalid date format.This exception is thrown when the user provides a date that does not match the expected format.
- Returns:
- An
AmadeusExceptionprompting the user to provide a date in a valid format.
-
errorSavingTask
Creates an exception for errors while saving tasks to the file. This is thrown when an IOException occurs during the save operation.- Parameters:
file- The error message from the IOException.- Returns:
- An AmadeusException with a message indicating the error while saving tasks.
-
errorLoadingTask
Creates an exception for errors while loading tasks from the file. This is thrown when an IOException occurs during the load operation.- Parameters:
file- The error message from the IOException.- Returns:
- An AmadeusException with a message indicating the error while loading tasks.
-
invalidTaskType
Creates an exception for an unrecognized task type found in the saved file.- Parameters:
type- The invalid task type found (e.g., not "T", "D", or "E").- Returns:
- An AmadeusException indicating the invalid task type.
-
errorParsingTask
Creates an exception for errors while parsing a task from the saved file. This is thrown when a line in the file cannot be parsed into a valid task.- Parameters:
line- The line from the file that caused the parsing error.- Returns:
- An AmadeusException with a message indicating the error while parsing the task.
-