Files
monasca-api/monasca_api/api/core/log/exceptions.py
Martin Chacon Piza a6e56ab63c Add Support for Falcon 3.0.0, 3.0.1
- Support to new Falcon 3.0.0 and 3.0.1 keeping compatibility
for version 2.0.0

- Remove Falcon's class OptionalRepresentation
Starting from Falcon 3.0.0 version the class OptionalRepresentation
was removed. [1]

- Remove unnecessary URL slashes which are not compatible
with Falcon >= 3.0.0

- Keep facon.API instead of new falcon.App to keep support for
version 2.0.0

- Disable temporary docker-build and docker-publish Zuul jobs.

[1] https://falcon.readthedocs.io/en/stable/changes/3.0.0.html#breaking-changes

Change-Id: Ifb067429dd66fd350110187ac3a8b6a9977bad90
2021-06-06 21:29:22 +02:00

36 lines
1.3 KiB
Python

# Copyright 2021 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import falcon
HTTP_422 = '422 Unprocessable Entity'
class HTTPUnprocessableEntity(falcon.HTTPError):
"""HTTPUnprocessableEntity http error.
HTTPError that comes with '422 Unprocessable Entity' status
:argument: message(str) - meaningful description of what caused an error
:argument: kwargs - any other option defined in
:py:class:`falcon.HTTPError`
"""
def __init__(self, message, **kwargs):
falcon.HTTPError.__init__(self,
HTTP_422,
'unprocessable_entity',
message,
**kwargs
)