summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/core')
-rw-r--r--src/leap/bitmask/core/dispatcher.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index 6a5603e..783094a 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -465,6 +465,16 @@ def _format_result(result):
def _format_error(failure):
- # TODO --- should check if the failure has the 'expected' attribute set
- logger.failure('[DISPATCHER] Uncatched error:')
+ """
+ Logs the failure backtrace, and returns a json containing the error
+ message.
+ """
+
+ # If a exception declares the 'expected' attribute as True,
+ # we will not print a full traceback
+ expected = getattr(failure.value, 'expected', False)
+ if not expected:
+ logger.failure('[DISPATCHER] Unexpected error:')
+
+ # if needed, we could add here the exception type as an extra field
return json.dumps({'error': failure.value.message, 'result': None})