From 95020a15388817c2b39c997d429b7ee89bb85586 Mon Sep 17 00:00:00 2001 From: Dinuka De Silva Date: Sat, 2 Nov 2019 17:10:20 +0530 Subject: [PATCH] Update the exceptions --- exception/__init__.py | 12 ++++++------ exception/messages.py | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/exception/__init__.py b/exception/__init__.py index 4b92945a..8b4feec0 100644 --- a/exception/__init__.py +++ b/exception/__init__.py @@ -2,24 +2,24 @@ def UnauthorizedException(message="", code=None): - raise ProblemException(401, "Unauthorized", message, "Unauthorized") + raise ProblemException(401, "Unauthorized", message, "Unauthorized", code) def ForbiddenException(message="", code=None): - raise ProblemException(403, "Forbidden", message, "Forbidden") + raise ProblemException(403, "Forbidden", message, "Forbidden", code) def NotFoundException(message="", code=None): - raise ProblemException(404, "Not Found", message, "NotFound") + raise ProblemException(404, "Not Found", message, "NotFound", code) def MethodNotAllowedException(message="", code=None): - raise ProblemException(405, "Method Not Allowed", message, "MethodNotAllowed") + raise ProblemException(405, "Method Not Allowed", message, "MethodNotAllowed", code) def InternalServerErrorException(message="", code=None): - raise ProblemException(500, "Internal Server Error", message, "InternalServerError") + raise ProblemException(500, "Internal Server Error", message, "InternalServerError", code) def NotImplementedException(message="", code=None): - raise ProblemException(501, "Not Implemented", message, "NotImplemented") + raise ProblemException(501, "Not Implemented", message, "NotImplemented", code) diff --git a/exception/messages.py b/exception/messages.py index 402cc1ce..705ef31e 100644 --- a/exception/messages.py +++ b/exception/messages.py @@ -21,3 +21,4 @@ MESSAGE_CODE_SUBMISSION_IRRELEVANT_VERSION_CANNOT_BE_MAPPED = 19 MESSAGE_CODE_SUBMISSION_NOT_FOUND = 21 # next: 23 +# Do not change the numbers and new always. These are linked to client applications.