aboutsummaryrefslogtreecommitdiff
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorDamien George2021-04-22 12:13:58 +1000
committerDamien George2021-04-27 23:51:52 +1000
commitd4b706c4d01377d42855ff1544ced77536f69caf (patch)
treecfdb78c011813396af745720c1a7754ac91487d7 /py/objexcept.c
parent30d9f77cc535306eeb9eed6f17e71355fd58995a (diff)
py: Add option to compile without any error messages at all.
This introduces a new option, MICROPY_ERROR_REPORTING_NONE, which completely disables all error messages. To be used in cases where MicroPython needs to fit in very limited systems. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objexcept.c')
-rw-r--r--py/objexcept.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index f6bffec38..f03bb1b41 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -373,6 +373,8 @@ mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args,
return mp_obj_exception_make_new(exc_type, n_args, 0, args);
}
+#if MICROPY_ERROR_REPORTING != MICROPY_ERROR_REPORTING_NONE
+
mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, mp_rom_error_text_t msg) {
// Check that the given type is an exception type
assert(exc_type->make_new == mp_obj_exception_make_new);
@@ -518,6 +520,8 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_er
return mp_obj_exception_make_new(exc_type, 1, 0, &arg);
}
+#endif
+
// return true if the given object is an exception type
bool mp_obj_is_exception_type(mp_obj_t self_in) {
if (mp_obj_is_type(self_in, &mp_type_type)) {