mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-07 15:23:19 +08:00
This also removes the outdated comments around authorship of each file. If there is still interest in this information, one can just look at the git history.
47 lines
715 B
Python
47 lines
715 B
Python
# -*- coding: utf-8 -*-
|
|
# SPDX-License-Identifier: MIT
|
|
""" Defines custom exceptions and error handling functions """
|
|
from flask import jsonify
|
|
|
|
|
|
class ValidationError(ValueError):
|
|
pass
|
|
|
|
|
|
class Unauthorized(ValueError):
|
|
pass
|
|
|
|
|
|
class Forbidden(ValueError):
|
|
pass
|
|
|
|
|
|
class UnprocessableEntity(ValueError):
|
|
pass
|
|
|
|
|
|
class Conflict(ValueError):
|
|
pass
|
|
|
|
|
|
class NotFound(ValueError):
|
|
pass
|
|
|
|
|
|
class ProgrammingError(ValueError):
|
|
pass
|
|
|
|
|
|
class StreamAmbigous(ValueError):
|
|
pass
|
|
|
|
|
|
class GreenwaveError(RuntimeError):
|
|
pass
|
|
|
|
|
|
def json_error(status, error, message):
|
|
response = jsonify({"status": status, "error": error, "message": message})
|
|
response.status_code = status
|
|
return response
|