source: src/mapservice/server_impl/HttpErrors.py@ 3db3d13

debian/bullseye
Last change on this file since 3db3d13 was 7be94aa, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago
  • Added yapf style config (src/python-style.yapf)
    • Updated all files to the yapf formatted version
  • Property mode set to 100644
File size: 2.7 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
[7be94aa]19from connexion.exceptions import ProblemException
20
[1cd45dd]21
22class MapserviceBadRequest(ProblemException, BadRequest):
[7be94aa]23 def __init__(
24 self,
25 type="bad-request",
26 title=None,
27 detail=None,
28 instance=None,
29 **kwargs
30 ):
31 super(MapserviceBadRequest, self).__init__(
32 status=400,
33 title="Bad Request",
34 detail=detail,
35 type=type,
36 instance=instance,
37 **kwargs
38 )
39
40
[1cd45dd]41class MapserviceUnauthorized(ProblemException, Unauthorized):
[7be94aa]42 def __init__(
43 self,
44 type="unauthorized",
45 title="Access denied",
46 detail="You need to login to access the requested resource",
47 instance=None,
48 **kwargs
49 ):
50 super(MapserviceUnauthorized, self).__init__(
51 status=401,
52 title=title,
53 detail=detail,
54 type=type,
55 instance=instance,
56 **kwargs
57 )
58
59
[1cd45dd]60class MapserviceNotFound(ProblemException, NotFound):
[7be94aa]61 def __init__(
62 self,
63 type="not-found",
64 title="Resouce not found",
65 detail="The requested resource was not found",
66 instance=None,
67 **kwargs
68 ):
69 super(MapserviceNotFound, self).__init__(
70 status=404,
71 title=title,
72 detail=detail,
73 type=type,
74 instance=instance,
75 **kwargs
76 )
77
[5e16955]78
79class MapserviceInternalServerError(ProblemException, InternalServerError):
[7be94aa]80 def __init__(
81 self,
82 type="internal-server-error",
83 title=None,
84 detail=None,
85 instance=None,
86 **kwargs
87 ):
88 super(MapserviceInternalServerError, self).__init__(
89 status=500,
90 title="Internal Server Error",
91 detail=detail,
92 type=type,
93 instance=instance,
94 **kwargs
95 )
Note: See TracBrowser for help on using the repository browser.