Errors added
This commit is contained in:
55
pyrmv/errors/api_errors.py
Normal file
55
pyrmv/errors/api_errors.py
Normal file
@@ -0,0 +1,55 @@
|
||||
class ApiAuthError(Exception):
|
||||
"""
|
||||
Access denied for accessId provided.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class ApiQuotaError(Exception):
|
||||
"""
|
||||
Quota exceeded for accessId provided.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class ApiTooManyRequests(Exception):
|
||||
"""
|
||||
Too many requests.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class ApiParamError(Exception):
|
||||
"""Exception raised for errors in the input arguments.
|
||||
|
||||
### Attributes:
|
||||
* errorCode: Client error code from HAFAS ReST Request Errors.
|
||||
* errorText: Description of an error occurred.
|
||||
"""
|
||||
|
||||
def __init__(self, errorCode: str, errorText: str):
|
||||
self.errorCode = errorCode
|
||||
self.errorText = errorText
|
||||
super().__init__(self.errorText)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.errorCode} -> {self.errorText}'
|
||||
|
||||
class ApiFormatError(Exception):
|
||||
"""
|
||||
Response format not supported.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
29
pyrmv/errors/int_errors.py
Normal file
29
pyrmv/errors/int_errors.py
Normal file
@@ -0,0 +1,29 @@
|
||||
class IntError(Exception):
|
||||
"""
|
||||
Internal RMV server error.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class IntGatewayError(Exception):
|
||||
"""
|
||||
Communication error with RMV backend systems.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class IntTimeoutError(Exception):
|
||||
"""
|
||||
Timeout during service processing.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
13
pyrmv/errors/ps_errors.py
Normal file
13
pyrmv/errors/ps_errors.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class PsIncorrectParamError(Exception):
|
||||
"""
|
||||
An invalid parameter combination was requested, i.e. the
|
||||
defined range of stable segments encompassed all public
|
||||
transport sections or it was attempted to search
|
||||
forward/backward from the end/beginning of the
|
||||
connection.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
49
pyrmv/errors/sot_errors.py
Normal file
49
pyrmv/errors/sot_errors.py
Normal file
@@ -0,0 +1,49 @@
|
||||
class SotAlreadyArrivedError(Exception):
|
||||
"""
|
||||
Trip already arrived.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SotNotStartedError(Exception):
|
||||
"""
|
||||
Trip not started.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SotCancelledError(Exception):
|
||||
"""
|
||||
Trip cancelled.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SotAllTrainsFilteredError(Exception):
|
||||
"""
|
||||
All trips filtered.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SotStayOnTripError(Exception):
|
||||
"""
|
||||
No change. Stay on trip.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
145
pyrmv/errors/svc_errors.py
Normal file
145
pyrmv/errors/svc_errors.py
Normal file
@@ -0,0 +1,145 @@
|
||||
class SvcParamError(Exception):
|
||||
"""Exception raised for errors in the input arguments.
|
||||
|
||||
### Attributes:
|
||||
* errorCode: Client error code from HAFAS ReST Request Errors.
|
||||
* errorText: Description of an error occurred.
|
||||
"""
|
||||
|
||||
def __init__(self, errorCode: str, errorText: str):
|
||||
self.errorCode = errorCode
|
||||
self.errorText = errorText
|
||||
super().__init__(self.errorText)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.errorCode} -> {self.errorText}'
|
||||
|
||||
class SvcLocationError(Exception):
|
||||
"""
|
||||
Location missing or invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcLocationArrivalError(Exception):
|
||||
"""
|
||||
Arrival location missing or invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcLocationDepartureError(Exception):
|
||||
"""
|
||||
Departure location missing or invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcLocationViaError(Exception):
|
||||
"""
|
||||
Unknown change stop.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcLocationEqualError(Exception):
|
||||
"""
|
||||
Origin/destination or vias are equal.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcLocationNearError(Exception):
|
||||
"""
|
||||
Origin and destination are too close.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcDatetimeError(Exception):
|
||||
"""
|
||||
Date/time are missing or invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcDatetimePeriodError(Exception):
|
||||
"""
|
||||
Date/time are not in timetable or allowed period.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcProductError(Exception):
|
||||
"""
|
||||
Product field missing or invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcContextError(Exception):
|
||||
"""
|
||||
Context is invalid.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcNoResultError(Exception):
|
||||
"""
|
||||
No result found.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcSearchError(Exception):
|
||||
"""
|
||||
Unsuccessful search.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
||||
|
||||
class SvcNoMatchError(Exception):
|
||||
"""
|
||||
No match found.
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__(self.__doc__)
|
||||
|
||||
def __str__(self):
|
||||
return self.__doc__
|
15
pyrmv/errors/unknown_error.py
Normal file
15
pyrmv/errors/unknown_error.py
Normal file
@@ -0,0 +1,15 @@
|
||||
class UnknownError(Exception):
|
||||
"""Exception raised but error is not known.
|
||||
|
||||
### Attributes:
|
||||
* errorCode: Client error code from HAFAS ReST Request Errors.
|
||||
* errorText: Description of an error occurred.
|
||||
"""
|
||||
|
||||
def __init__(self, errorCode: str, errorText: str):
|
||||
self.errorCode = errorCode
|
||||
self.errorText = errorText
|
||||
super().__init__(self.errorText)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.errorCode} -> {self.errorText}'
|
Reference in New Issue
Block a user