Skip to content

Commit 9974f7e

Browse files
committed
Fixed handling exceptions with binary messages
1 parent 5fa2b4b commit 9974f7e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

atest/tests/failures.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Non-ASCII message
3232
Non-ASCII bytes
3333
Exception 'Hyv\\xe4' Hyv\uFFFD evaluate=yes
3434

35+
Binary message
36+
Exception \x00.\x01.\x02
37+
3538
Failure deeper
3639
[Documentation] FAIL Finally failing
3740
[Template] NONE

src/robotremoteserver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@ def _get_error_message(self, exc_type, exc_value):
177177
def _get_message_from_exception(self, value):
178178
# UnicodeError occurs below 2.6 and if message contains non-ASCII bytes
179179
try:
180-
return unicode(value)
180+
msg = unicode(value)
181181
except UnicodeError:
182-
return ' '.join([unicode(a, errors='replace') for a in value.args])
182+
msg = ' '.join([unicode(a, errors='replace') for a in value.args])
183+
return self._handle_binary_result(msg)
183184

184185
def _get_error_traceback(self, exc_tb):
185186
# Latest entry originates from this class so it can be removed

0 commit comments

Comments
 (0)