Source code for ecstask.productavailability.exceptions.product_availability_service_exception
[docs]class PayloadValidationException(Exception):
"""Base class to handle payload validation exceptions"""
[docs]class HeaderValidationException(Exception):
"""Base class to handle Header validation exceptions"""
[docs]class PayloadValidationError(PayloadValidationException):
"""Exception raised when there is an error while validating fields from the payload
Attributes:
message (String): explanation of the error
"""
[docs] def __init__(self, message='An error occurred while validating request payload, '
'this is probably due to one of the required field missing from the request, '
'See logs for more details', http_status=0):
self.message = message
self.http_status = http_status
[docs]class HeaderValidationError(HeaderValidationException):
"""Exception raised when there is an error while validating fields from the header
Attributes:
message (String): explanation of the error
"""
[docs] def __init__(self, message='An error occurred while validating request payload, '
'this is probably due to one of the required field misisng from the request, '
'See logs for more details', http_status=0):
self.message = message
self.http_status = http_status