aboutsummaryrefslogtreecommitdiff
path: root/ports/nrf/boards
diff options
context:
space:
mode:
authorDamien George2019-11-05 11:33:03 +1100
committerDamien George2019-11-05 11:35:45 +1100
commitc13f9f209d7a343fe306a24a04eb934ce905b631 (patch)
tree1f663134d7784aa0a2b43fe349e49ad82f5817f8 /ports/nrf/boards
parent80df377e9512ac839ab19192ff1897ba30be098b (diff)
all: Convert nlr_raise(mp_obj_new_exception_msg(x)) to mp_raise_msg(x).
This helper function was added a while ago and these are the remaining cases to convert, to save a bit of code size.
Diffstat (limited to 'ports/nrf/boards')
-rw-r--r--ports/nrf/boards/microbit/modules/microbitimage.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ports/nrf/boards/microbit/modules/microbitimage.c b/ports/nrf/boards/microbit/modules/microbitimage.c
index fca507508..ce4a959f0 100644
--- a/ports/nrf/boards/microbit/modules/microbitimage.c
+++ b/ports/nrf/boards/microbit/modules/microbitimage.c
@@ -227,8 +227,7 @@ STATIC mp_obj_t microbit_image_make_new(const mp_obj_type_t *type_in, mp_uint_t
return image_from_parsed_str(str, len);
}
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
- "Image(s) takes a string."));
+ mp_raise_msg(&mp_type_TypeError, "Image(s) takes a string.");
}
}
@@ -259,8 +258,7 @@ STATIC mp_obj_t microbit_image_make_new(const mp_obj_type_t *type_in, mp_uint_t
}
default: {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
- "Image() takes 0 to 3 arguments"));
+ mp_raise_msg(&mp_type_TypeError, "Image() takes 0 to 3 arguments");
}
}
}
@@ -365,7 +363,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(microbit_image_get_pixel_obj, microbit_image_get_pixel
/* Raise an exception if not mutable */
static void check_mutability(microbit_image_obj_t *self) {
if (self->base.five) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "image cannot be modified (try copying first)"));
+ mp_raise_msg(&mp_type_TypeError, "image cannot be modified (try copying first)");
}
}
@@ -408,11 +406,10 @@ mp_obj_t microbit_image_blit(mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_t src = args[1];
if (mp_obj_get_type(src) != &microbit_image_type) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "expecting an image"));
+ mp_raise_msg(&mp_type_TypeError, "expecting an image");
}
if (n_args == 7) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
- "must specify both offsets"));
+ mp_raise_msg(&mp_type_TypeError, "must specify both offsets");
}
mp_int_t x = mp_obj_get_int(args[2]);
mp_int_t y = mp_obj_get_int(args[3]);