From a4c06456221b46f02e95e63d1015bbbca8804e8f Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Tue, 11 Jun 2019 18:07:18 +0300 Subject: [PATCH] core: return exception details in debug mode (#238) --- core/src/trezor/wire/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 903eefaa9..e2fe9b6b9 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -173,11 +173,12 @@ async def protobuf_workflow(ctx, reader, handler, *args): # respond with specific code and message await ctx.write(Failure(code=exc.code, message=exc.message)) raise - except Exception: + except Exception as e: # respond with a generic code and message - await ctx.write( - Failure(code=FailureType.FirmwareError, message="Firmware error") - ) + message = "Firmware error" + if __debug__: + message = "{}: {}".format(type(e), e) + await ctx.write(Failure(code=FailureType.FirmwareError, message=message)) raise if res: # respond with a specific response