all: Use MP_ERROR_TEXT for all error messages.

This commit is contained in:
Jim Mussared
2020-03-02 22:35:22 +11:00
committed by Damien George
parent 85858e72df
commit def76fe4d9
192 changed files with 823 additions and 919 deletions

View File

@@ -228,7 +228,7 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
}
#else
// If we get here then the file was not frozen and we can't compile scripts.
mp_raise_msg(&mp_type_ImportError, "script compilation not supported");
mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("script compilation not supported"));
#endif
}
@@ -313,7 +313,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// We must have some component left over to import from
if (p == this_name) {
mp_raise_ValueError("cannot perform relative import");
mp_raise_ValueError(MP_ERROR_TEXT("cannot perform relative import"));
}
uint new_mod_l = (mod_len == 0 ? (size_t)(p - this_name) : (size_t)(p - this_name) + 1 + mod_len);
@@ -397,9 +397,9 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
if (module_obj == MP_OBJ_NULL) {
// couldn't find the file, so fail
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_raise_msg(&mp_type_ImportError, "module not found");
mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("module not found"));
#else
mp_raise_msg_varg(&mp_type_ImportError, "no module named '%q'", mod_name);
mp_raise_msg_varg(&mp_type_ImportError, MP_ERROR_TEXT("no module named '%q'"), mod_name);
#endif
}
} else {
@@ -478,7 +478,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// Check that it's not a relative import
if (n_args >= 5 && MP_OBJ_SMALL_INT_VALUE(args[4]) != 0) {
mp_raise_NotImplementedError("relative import");
mp_raise_NotImplementedError(MP_ERROR_TEXT("relative import"));
}
// Check if module already exists, and return it if it does
@@ -500,9 +500,9 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// Couldn't find the module, so fail
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_raise_msg(&mp_type_ImportError, "module not found");
mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("module not found"));
#else
mp_raise_msg_varg(&mp_type_ImportError, "no module named '%q'", module_name_qstr);
mp_raise_msg_varg(&mp_type_ImportError, MP_ERROR_TEXT("no module named '%q'"), module_name_qstr);
#endif
}