Changeset 7be94aa for src/mapservice/server_impl/HttpErrors.py
- Timestamp:
- Apr 11, 2020, 4:46:15 PM (7 years ago)
- Branches:
- debian/bullseye, master
- Children:
- 3db3d13
- Parents:
- da2be70
- File:
-
- 1 edited
-
src/mapservice/server_impl/HttpErrors.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/mapservice/server_impl/HttpErrors.py
rda2be70 r7be94aa 17 17 18 18 from werkzeug.exceptions import BadRequest, Unauthorized, NotFound, InternalServerError 19 from connexion.exceptions import ProblemException 19 from connexion.exceptions import ProblemException 20 20 21 21 22 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 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 25 41 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 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 29 60 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) 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 32 78 33 79 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) 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 TracChangeset
for help on using the changeset viewer.
