summaryrefslogtreecommitdiff
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-08-08 18:24:49 -0700
committerScott Shawcroft <scott@tannewt.org>2018-08-09 13:29:30 -0700
commit96ebf5bc3fb455162286b9bc31e763f3c4f1c457 (patch)
tree3d06bc866bcf943a0e0ea881a1fcab9826291a1c /py/objexcept.c
parent9da79c880e387ab05a683b67feb8f3da600d937d (diff)
Two fixes and translate more strings.
* Fix finding translations with escaped characters. * Add back \r to translations since its needed by screen.
Diffstat (limited to 'py/objexcept.c')
-rw-r--r--py/objexcept.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index 5b5650c5f..68897d44d 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -37,6 +37,8 @@
#include "py/gc.h"
#include "py/mperrno.h"
+#include "supervisor/shared/translate.h"
+
// Number of items per traceback entry (file, line, block)
#define TRACEBACK_ENTRY_LEN (3)
@@ -112,9 +114,9 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
} else if (o->args->len == 1) {
// try to provide a nice OSError error message
if (o->base.type == &mp_type_OSError && MP_OBJ_IS_SMALL_INT(o->args->items[0])) {
- qstr qst = mp_errno_to_str(o->args->items[0]);
- if (qst != MP_QSTR_NULL) {
- mp_printf(print, "[Errno " INT_FMT "] %q", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), qst);
+ const char* msg = mp_errno_to_str(o->args->items[0]);
+ if (msg[0] != '\0') {
+ mp_printf(print, "[Errno " INT_FMT "] %s", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), msg);
return;
}
}