--- a/cubicweb/web/_exceptions.py Thu May 16 02:39:40 2019 +0200
+++ b/cubicweb/web/_exceptions.py Thu May 16 02:39:41 2019 +0200
@@ -30,12 +30,14 @@
def __init__(self, response):
self.response = response
+
class InvalidSession(CubicWebException):
"""raised when a session id is found but associated session is not found or
invalid"""
# Publish related exception
+
class PublishException(CubicWebException):
"""base class for publishing related exception"""
@@ -43,6 +45,7 @@
self.status = kwargs.pop('status', http_client.OK)
super(PublishException, self).__init__(*args, **kwargs)
+
class LogOut(PublishException):
"""raised to ask for deauthentication of a logged in user"""
@@ -50,6 +53,7 @@
super(LogOut, self).__init__()
self.url = url
+
class Redirect(PublishException):
"""raised to redirect the http request"""
@@ -57,6 +61,7 @@
super(Redirect, self).__init__(status=status)
self.location = location
+
class StatusResponse(PublishException):
def __init__(self, status, content=''):
@@ -68,6 +73,7 @@
# Publish related error
+
class RequestError(PublishException):
"""raised when a request can't be served because of a bad input"""
@@ -83,6 +89,7 @@
kwargs.setdefault('status', http_client.BAD_REQUEST)
super(NothingToEdit, self).__init__(*args, **kwargs)
+
class ProcessFormError(RequestError):
"""raised when posted data can't be processed by the corresponding field
"""
@@ -91,6 +98,7 @@
kwargs.setdefault('status', http_client.BAD_REQUEST)
super(ProcessFormError, self).__init__(*args, **kwargs)
+
class NotFound(RequestError):
"""raised when something was not found. In most case,
a 404 error should be returned"""
@@ -99,6 +107,7 @@
kwargs.setdefault('status', http_client.NOT_FOUND)
super(NotFound, self).__init__(*args, **kwargs)
+
class RemoteCallFailed(RequestError):
"""raised when a json remote call fails
"""