errors: only use err msg map when args don't have it

This commit is contained in:
Luna 2019-02-16 21:13:16 -03:00
parent 89f013c778
commit 3247323a95
1 changed files with 5 additions and 5 deletions

View File

@ -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