diff options
| author | Damien George | 2017-06-15 11:54:41 +1000 |
|---|---|---|
| committer | Damien George | 2017-06-15 11:54:41 +1000 |
| commit | 48d867b4a68e53901aac87c2ff0f2a7e65f735c7 (patch) | |
| tree | 178bfc0dc13bcb3b9d77c8a99652e9a9dc057e7d /extmod | |
| parent | 1e70fda69fcb4991eb60ed43e610f664ea1319e6 (diff) | |
all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers.
Diffstat (limited to 'extmod')
| -rw-r--r-- | extmod/modframebuf.c | 3 | ||||
| -rw-r--r-- | extmod/modubinascii.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index a07392675..062a63c3b 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -244,8 +244,7 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size o->stride = (o->stride + 7) & ~7; break; default: - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, - "invalid format")); + mp_raise_ValueError("invalid format"); } return MP_OBJ_FROM_PTR(o); diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 2ef1a6f21..07b8b15bf 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -75,7 +75,7 @@ mp_obj_t mod_binascii_unhexlify(mp_obj_t data) { mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ); if ((bufinfo.len & 1) != 0) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "odd-length string")); + mp_raise_ValueError("odd-length string"); } vstr_t vstr; vstr_init_len(&vstr, bufinfo.len / 2); @@ -86,7 +86,7 @@ mp_obj_t mod_binascii_unhexlify(mp_obj_t data) { if (unichar_isxdigit(hex_ch)) { hex_byte += unichar_xdigit_value(hex_ch); } else { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "non-hex digit found")); + mp_raise_ValueError("non-hex digit found"); } if (i & 1) { hex_byte <<= 4; |
