Skip to content

Commit 85ce95d

Browse files
committed
Modified error formatting to remove unicode character.
jsonschema's error.message returns either u' or ' in strings depending on the python version.
1 parent b286838 commit 85ce95d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

tools/config/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ def format_validation_error(self, error, path):
393393
return self.format_validation_error(error.context[0], path)
394394
else:
395395
return "in {} element {}: {}".format(
396-
path, str(".".join(str(p) for p in error.absolute_path)), error.message)
396+
path, ".".join(p for p in error.absolute_path),
397+
error.message.replace('u\'','\''))
397398

398399
def __init__(self, tgt, top_level_dirs=None, app_config=None):
399400
"""Construct a mbed configuration
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"K64F": {
3-
"exception_msg": "Additional properties are not allowed (u'unknown_key' was unexpected)"
3+
"exception_msg": "Additional properties are not allowed ('unknown_key' was unexpected)"
44
}
55
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"K64F": {
3-
"exception_msg": "Additional properties are not allowed (u'unknown_key' was unexpected)"
3+
"exception_msg": "Additional properties are not allowed ('unknown_key' was unexpected)"
44
}
55
}

0 commit comments

Comments
 (0)