Errors

Remember:

  • These examples are asynchronous and need to be run within an async function using await.
  • You'll need to have the MultiFeatures package installed to run these examples.
  • Install the package using pip install -U MultiFeatures.

Error Classes

BaseError

Base class for all errors in the IndianRailway module.

Attributes:

  • message (str): A general error message.
  • success (bool): Always False, indicating an error occurred.
  • error_message (str): The specific error message.

NotAValidTrainNumber

Raised when an invalid train number is provided.

Attributes:

  • message (str): "Not a valid train number"

NotAValidStationCode

Raised when an invalid station code is provided.

Attributes:

  • message (str): "Not a valid Station Code"

InternetUnreachable

Raised when there's an issue connecting to the internet.

Attributes:

  • message (str): "Cannot connect to the internet"

HTTPErr

Raised when the HTTP response status code is not 200.

Attributes:

  • message (str): "Response status code is not 200"
  • status_code (int): The actual HTTP status code received.
  • error_message (str): The specific error message.