all: Use MP_ERROR_TEXT for all error messages.
This commit is contained in:
committed by
Damien George
parent
85858e72df
commit
def76fe4d9
@@ -50,7 +50,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___init___obj, object___init__);
|
||||
|
||||
STATIC mp_obj_t object___new__(mp_obj_t cls) {
|
||||
if (!mp_obj_is_type(cls, &mp_type_type) || !mp_obj_is_instance_type((mp_obj_type_t *)MP_OBJ_TO_PTR(cls))) {
|
||||
mp_raise_TypeError("arg must be user-type");
|
||||
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
|
||||
}
|
||||
// This executes only "__new__" part of instance creation.
|
||||
// TODO: This won't work well for classes with native bases.
|
||||
@@ -65,7 +65,7 @@ STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, MP_ROM_PTR(&object__
|
||||
#if MICROPY_PY_DELATTR_SETATTR
|
||||
STATIC mp_obj_t object___setattr__(mp_obj_t self_in, mp_obj_t attr, mp_obj_t value) {
|
||||
if (!mp_obj_is_instance_type(mp_obj_get_type(self_in))) {
|
||||
mp_raise_TypeError("arg must be user-type");
|
||||
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
|
||||
}
|
||||
|
||||
if (!mp_obj_is_str(attr)) {
|
||||
@@ -80,7 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(object___setattr___obj, object___setattr__);
|
||||
|
||||
STATIC mp_obj_t object___delattr__(mp_obj_t self_in, mp_obj_t attr) {
|
||||
if (!mp_obj_is_instance_type(mp_obj_get_type(self_in))) {
|
||||
mp_raise_TypeError("arg must be user-type");
|
||||
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
|
||||
}
|
||||
|
||||
if (!mp_obj_is_str(attr)) {
|
||||
@@ -89,7 +89,7 @@ STATIC mp_obj_t object___delattr__(mp_obj_t self_in, mp_obj_t attr) {
|
||||
|
||||
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (mp_map_lookup(&self->members, attr, MP_MAP_LOOKUP_REMOVE_IF_FOUND) == NULL) {
|
||||
mp_raise_msg(&mp_type_AttributeError, "no such attribute");
|
||||
mp_raise_msg(&mp_type_AttributeError, MP_ERROR_TEXT("no such attribute"));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user