| 1 | '''
|
|---|
| 2 | Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 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 |
|
|---|
| 18 | from werkzeug.exceptions import BadRequest, Unauthorized, NotFound, InternalServerError
|
|---|
| 19 | from connexion.exceptions import ProblemException
|
|---|
| 20 |
|
|---|
| 21 | class 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 |
|
|---|
| 25 | class 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):
|
|---|
| 27 | super(MapserviceUnauthorized, self).__init__(status=401, title=title, detail=detail, type=type, instance=instance, **kwargs)
|
|---|
| 28 |
|
|---|
| 29 | class MapserviceNotFound(ProblemException, NotFound):
|
|---|
| 30 | def __init__(self, type="not-found", title="Resouce not found", detail="The requested resource was not found", instance=None, **kwargs):
|
|---|
| 31 | super(MapserviceNotFound, self).__init__(status=404, title=title, detail=detail, type=type, instance=instance, **kwargs)
|
|---|
| 32 |
|
|---|
| 33 | class 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)
|
|---|