Skip to content

Commit

Permalink
0.1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
xncbf committed Feb 9, 2022
1 parent c54bb81 commit 5d66f89
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ try:
except MessageException as e:
print(f"ERROR MESSAGE: {e}")

ERROR MESSAGE: missing_authorization_header
ERROR MESSAGE: Valid access token in Authorization header is required for RESTful API calls.
>>>
```

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rcs-pydantic"
version = "0.1.23"
version = "0.1.24"
description = ""
authors = ["xncbf <xncbf12@gmail.com>"]
keywords = ["pydantic", "rcs", "fastapi"]
Expand Down
8 changes: 4 additions & 4 deletions rcs_pydantic/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
class MessageException(Exception):
def __init__(self, message: int):
if errors.ErrorCodeEnum.has_value(message):
self.message = errors.ErrorCodeEnum(message).name.lower()
self.message = errors.ErrorCodeEnum(message).value[1]
elif errors.MaaPErrorCodeEnum.has_value(message):
self.message = errors.MaaPErrorCodeEnum(message).name.lower()
self.message = errors.MaaPErrorCodeEnum(message).value[1]
elif errors.RcsBizCenterErrorCodeEnum.has_value(message):
self.message = errors.RcsBizCenterErrorCodeEnum(message).name.lower()
self.message = errors.RcsBizCenterErrorCodeEnum(message).value[1]
elif errors.KTErrorCodeEnum.has_value(message):
self.message = errors.KTErrorCodeEnum(message).name.lower()
self.message = errors.KTErrorCodeEnum(message).value[1]
else:
self.message = "unknown"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_rcs_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def test_exception_error_message():
try:
raise MessageException(ErrorCodeEnum.MISSING_AUTHORIZATION_HEADER.value[0])
except MessageException as e:
assert e.message == "missing_authorization_header"
assert str(e) == "missing_authorization_header"
assert e.message == "Valid access token in Authorization header is required for RESTful API calls."
assert str(e) == "Valid access token in Authorization header is required for RESTful API calls."


def test_error_code_message_exception():
Expand Down

0 comments on commit 5d66f89

Please sign in to comment.