mirror of https://gitlab.com/litecord/litecord.git
errors: only use err msg map when args don't have it
This commit is contained in:
parent
89f013c778
commit
3247323a95
|
|
@ -77,14 +77,14 @@ class LitecordError(Exception):
|
|||
@property
|
||||
def message(self) -> str:
|
||||
"""Get an error's message string."""
|
||||
try:
|
||||
return self.args[0]
|
||||
except IndexError:
|
||||
err_code = getattr(self, 'error_code', None)
|
||||
|
||||
if err_code is not None:
|
||||
return ERR_MSG_MAP.get(err_code) or self.args[0]
|
||||
|
||||
try:
|
||||
return self.args[0]
|
||||
except IndexError:
|
||||
return repr(self)
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Reference in New Issue