[docs]defget_explanation(self)->str:""" Gets the explanation. :returns: The explanation. :rtype: str """returnf"Message: {self.messageifself.messageelse'missing'}"
def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"pyEchoNextException has been raised. {self.get_explanation()}"
[docs]defget_explanation(self)->str:""" Gets the explanation. :returns: The explanation. :rtype: str """return(f"Code: {self.code}. Message: {self.messageifself.messageelse'missing'}")
def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"WebError has been raised. {self.get_explanation()}"
[docs]classInternationalizationNotFound(pyEchoNextException):def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"InternationalizationNotFound has been raised. {self.get_explanation()}"
[docs]classLocalizationNotFound(pyEchoNextException):def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"LocalizationNotFound has been raised. {self.get_explanation()}"
[docs]classTemplateNotFileError(pyEchoNextException):def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"TemplateNotFileError has been raised. {self.get_explanation()}"
[docs]classRoutePathExistsError(pyEchoNextException):def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"RoutePathExistsError has been raised. {self.get_explanation()}"
[docs]classStaticFileNotFoundError(pyEchoNextException):def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"StaticFileNotFoundError has been raised. {self.get_explanation()}"
[docs]classURLNotFound(WebError):code=404def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"URLNotFound has been raised. {self.get_explanation()}"
[docs]classMethodNotAllow(WebError):code=405def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"MethodNotAllow has been raised. {self.get_explanation()}"
[docs]classTeapotError(WebError):code=418def__str__(self):""" Returns a string representation of the object. :returns: String representation of the object. :rtype: str """logger.error(f"{self.__class__.__name__}: {self.get_explanation()}")returnf"The server refuses to make coffee because he is a teapot. {self.get_explanation()}"