mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.App.__run(): Beautify error logging
Without --backtrace, the outmost try-catch block logs exceptions plainly as their text. If it catches a key error, the exception text only consists of the key itself, which can be easily mistaken for a normal program output, so prefix it with a "Failed:". Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e33bc8e793
commit
1b2ebab33a
1 changed files with 1 additions and 2 deletions
|
|
@ -131,9 +131,8 @@ class App: # export
|
||||||
ret = await self._run(self.__args)
|
ret = await self._run(self.__args)
|
||||||
if isinstance(ret, int) and ret >= 0 and ret <= 0xFF:
|
if isinstance(ret, int) and ret >= 0 and ret <= 0xFF:
|
||||||
exit_status = ret
|
exit_status = ret
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(ERR, repr(e) if self.__back_trace else str(e))
|
log(ERR, 'Failed: {}'.format(repr(e) if self.__back_trace else str(e)))
|
||||||
exit_status = 1
|
exit_status = 1
|
||||||
if self.__back_trace:
|
if self.__back_trace:
|
||||||
raise
|
raise
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue