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
|
@property
|
||||||
def message(self) -> str:
|
def message(self) -> str:
|
||||||
"""Get an error's message string."""
|
"""Get an error's message string."""
|
||||||
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:
|
try:
|
||||||
return self.args[0]
|
return self.args[0]
|
||||||
except IndexError:
|
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]
|
||||||
|
|
||||||
return repr(self)
|
return repr(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue