Skip to content

Commit

Permalink
Update the exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dinukadesilva committed Nov 2, 2019
1 parent 7d2abef commit 95020a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions exception/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions exception/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 95020a1

Please sign in to comment.