diff --git a/flaschengeist/controller/roleController.py b/flaschengeist/controller/roleController.py index 9d214b0..c8b0cb2 100644 --- a/flaschengeist/controller/roleController.py +++ b/flaschengeist/controller/roleController.py @@ -1,5 +1,5 @@ from sqlalchemy.exc import IntegrityError -from werkzeug.exceptions import BadRequest, NotFound +from werkzeug.exceptions import BadRequest, Conflict, NotFound from flaschengeist.models.user import Role, Permission from flaschengeist.database import db, case_sensitive @@ -71,4 +71,4 @@ def delete(role): db.session.commit() except IntegrityError: logger.debug("IntegrityError: Role might still be in use", exc_info=True) - raise BadRequest("Role still in use") + raise Conflict("Role still in use") diff --git a/flaschengeist/plugins/roles/__init__.py b/flaschengeist/plugins/roles/__init__.py index 80deca7..954ba21 100644 --- a/flaschengeist/plugins/roles/__init__.py +++ b/flaschengeist/plugins/roles/__init__.py @@ -134,7 +134,7 @@ def delete_role(role_id, current_session): current_session: Session sent with Authorization Header Returns: - HTTP-204 or HTTP error + HTTP-204 or HTTP error (HTTP-409 Conflict if role still in use) """ role = roleController.get(role_id) roleController.delete(role)