| [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] | 18 | from werkzeug.exceptions import BadRequest, Unauthorized, NotFound, InternalServerError
|
|---|
| [7be94aa] | 19 | from connexion.exceptions import ProblemException
|
|---|
| 20 |
|
|---|
| [1cd45dd] | 21 |
|
|---|
| 22 | class 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] | 41 | class 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] | 60 | class 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 |
|
|---|
| 79 | class 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 | )
|
|---|