Commit 2bd2455a authored by Arnaud Vergnet's avatar Arnaud Vergnet
Browse files

feat: catch more authentication errors

parent d6abe1425481
Pipeline #135472 passed with stages
in 1 minute and 11 seconds
......@@ -16,7 +16,7 @@
# along with this program. If not, see <>.
from enum import Enum
from cubicweb import AuthenticationError, QueryError
from cubicweb import AuthenticationError, QueryError, Unauthorized, Forbidden
from cubicweb.schema_exporters import JSONSchemaExporter
from rql import RQLException
from yams import ValidationError, UnknownType
......@@ -78,6 +78,6 @@
return func(request)
except HTTPError as e:
return e
except AuthenticationError as e:
except (AuthenticationError, Unauthorized) as e:, exc_info=True)
return get_http_error(401, e.__class__.__name__, str(e))
......@@ -82,5 +82,8 @@, exc_info=True)
return get_http_error(401, e.__class__.__name__, str(e))
except Forbidden as e:, exc_info=True)
return get_http_error(403, e.__class__.__name__, str(e))
except Exception:"ServerError", exc_info=True)
raise get_http_500_error()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment