1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

firmware: log exceptions in debug mode (no silent unhandled exceptions)

This commit is contained in:
Milan Rossa 2018-10-10 15:43:33 +02:00 committed by Jan Pochyla
parent f07dfe9344
commit b2327c37b7
4 changed files with 13 additions and 4 deletions

View File

@ -416,8 +416,10 @@ class ConfirmContent(ui.Widget):
try:
namepart = name.lower().replace(" ", "_")
icon = res.load("apps/fido_u2f/res/u2f_%s.toif" % namepart)
except Exception:
except Exception as e:
icon = res.load("apps/fido_u2f/res/u2f_generic.toif")
if __debug__:
log.exception(__name__, e)
else:
name = "%s...%s" % (
hexlify(self.app_id[:4]).decode(),

View File

@ -1,4 +1,4 @@
from trezor import config, loop, res, ui
from trezor import config, log, loop, res, ui
from trezor.pin import pin_to_int, show_pin_timeout
from apps.common.request_pin import request_pin
@ -18,8 +18,9 @@ async def bootscreen():
return
else:
label = "Wrong PIN, enter again"
except: # noqa: E722
pass
except Exception as e:
if __debug__:
log.exception(__name__, e)
async def lockscreen():

View File

@ -261,6 +261,8 @@ class spawn(Syscall):
result = await child
except Exception as e:
self._finish(child, index, e)
if __debug__:
log.exception(__name__, e)
else:
self._finish(child, index, result)

View File

@ -29,4 +29,8 @@ def get_type(wire_type):
# build reverse table of wire types
for msg_name in dir(MessageType):
# Modules contain internal variables that may cause exception here.
# No Message begins with underscore so it's safe to skip those.
if (msg_name[0] == '_'):
continue
type_to_name[getattr(MessageType, msg_name)] = msg_name