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

@@ -45,7 +45,7 @@ STATIC mp_int_t fibonacci_helper(mp_int_t x) {
STATIC mp_obj_t fibonacci(mp_obj_t x_in) {
mp_int_t x = mp_obj_get_int(x_in);
if (x < 0) {
mp_raise_ValueError("can't compute negative Fibonacci number");
mp_raise_ValueError(MP_ERROR_TEXT("can't compute negative Fibonacci number"));
}
return mp_obj_new_int(fibonacci_helper(x));
}

View File

@@ -52,7 +52,7 @@ STATIC mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_o
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_RW);
if (bufinfo.typecode != 'f') {
mp_raise_ValueError("expecting float array");
mp_raise_ValueError(MP_ERROR_TEXT("expecting float array"));
}
// Compute product, store result back in first element of array

View File

@@ -15,7 +15,7 @@ void mp_stack_check(void) {
// Assumes descending stack on target
volatile char dummy;
if (stack_top - &dummy >= STACK_LIMIT) {
mp_raise_msg(&mp_type_RuntimeError, "maximum recursion depth exceeded");
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("maximum recursion depth exceeded"));
}
}