Skip to content

Commit 26995b1

Browse files
committed
Fixed handling non-ASCII error messages. First enhancement in this repository.
I have a feeling that this simple solution doesn't work with Python/Jython 2.5. Due to work-in-progress changes for run.py, I cannot at the moment easily verify that. Will fix run.py next and come back to this then.
1 parent 7f066ad commit 26995b1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/robotremoteserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def _get_error_details(self):
134134

135135
def _get_error_message(self, exc_type, exc_value):
136136
name = exc_type.__name__
137-
message = str(exc_value)
137+
message = unicode(exc_value)
138138
if not message:
139139
return name
140140
if exc_type in self._generic_exceptions:

test/atest/failures.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*** Settings ***
22
Resource resource.txt
3+
Variables arguments.py
34

45
*** Test Cases ***
56
Base Exception
@@ -30,3 +31,6 @@ Failure Deeper
3031
[Documentation] FAIL Finally failing
3132
Failure Deeper
3233

34+
Non-ASCII Error Message
35+
[Documentation] FAIL ${UNICODE STRING}
36+
Non ASCII Error Message

test/libs/examplelib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def failure_deeper(self, rounds=10):
8282
raise RuntimeError('Finally failing')
8383
self.failure_deeper(rounds-1)
8484

85+
def non_ascii_error_message(self):
86+
raise Exception(self._unicode)
87+
8588
# Arguments counts
8689

8790
def no_arguments(self):

0 commit comments

Comments
 (0)