source: src/mapservice/server_impl/HttpErrors.py@ ff880df

debian/bullseye
Last change on this file since ff880df was ae2ff15, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago
  • Fixed testing environment
    • Fixed some issues in the API and it's serving
  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[ea6eba1]1'''
[5e16955]2 Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
[ea6eba1]3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16'''
17
[5e16955]18from werkzeug.exceptions import BadRequest, Unauthorized, NotFound, InternalServerError
[1cd45dd]19from connexion.exceptions import ProblemException
20
21class MapserviceBadRequest(ProblemException, BadRequest):
22 def __init__(self, type="bad-request", title=None, detail=None, instance=None, **kwargs):
23 super(MapserviceBadRequest, self).__init__(status=400, title="Bad Request", detail=detail, type=type, instance=instance, **kwargs)
24
25class MapserviceUnauthorized(ProblemException, Unauthorized):
26 def __init__(self, type="unauthorized", title="Access denied", detail="You need to login to access the requested resource", instance=None, **kwargs):
[ec9e811]27 super(MapserviceUnauthorized, self).__init__(status=401, title=title, detail=detail, type=type, instance=instance, **kwargs)
[1cd45dd]28
29class MapserviceNotFound(ProblemException, NotFound):
30 def __init__(self, type="not-found", title="Resouce not found", detail="The requested resource was not found", instance=None, **kwargs):
[ec9e811]31 super(MapserviceNotFound, self).__init__(status=404, title=title, detail=detail, type=type, instance=instance, **kwargs)
[5e16955]32
33class MapserviceInternalServerError(ProblemException, InternalServerError):
34 def __init__(self, type="internal-server-error", title=None, detail=None, instance=None, **kwargs):
35 super(MapserviceInternalServerError, self).__init__(status=500, title="Internal Server Error", detail=detail, type=type, instance=instance, **kwargs)
Note: See TracBrowser for help on using the repository browser.