@@ -65,12 +65,12 @@ STATIC mp_obj_t espidf_heap_caps_get_largest_free_block(void) {
65
65
}
66
66
MP_DEFINE_CONST_FUN_OBJ_0 (espidf_heap_caps_get_largest_free_block_obj , espidf_heap_caps_get_largest_free_block );
67
67
68
- //| class MemoryError(MemoryError ):
69
- //| """Raised when an ESP IDF memory allocation fails ."""
68
+ //| class IDFError(OSError ):
69
+ //| """Raised for certain generic ESP IDF errors ."""
70
70
//| ...
71
71
//|
72
- NORETURN void mp_raise_espidf_MemoryError (void ) {
73
- nlr_raise (mp_obj_new_exception (& mp_type_espidf_MemoryError ));
72
+ NORETURN void mp_raise_espidf_IDFError (void ) {
73
+ nlr_raise (mp_obj_new_exception (& mp_type_espidf_IDFError ));
74
74
}
75
75
76
76
void espidf_exception_print (const mp_print_t * print , mp_obj_t o_in , mp_print_kind_t kind ) {
@@ -83,6 +83,24 @@ void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin
83
83
mp_obj_exception_print (print , o_in , kind );
84
84
}
85
85
86
+ const mp_obj_type_t mp_type_espidf_IDFError = {
87
+ { & mp_type_type },
88
+ .name = MP_QSTR_IDFError ,
89
+ .print = espidf_exception_print ,
90
+ .make_new = mp_obj_exception_make_new ,
91
+ .attr = mp_obj_exception_attr ,
92
+ .parent = & mp_type_OSError ,
93
+ };
94
+
95
+
96
+ //| class MemoryError(MemoryError):
97
+ //| """Raised when an ESP IDF memory allocation fails."""
98
+ //| ...
99
+ //|
100
+ NORETURN void mp_raise_espidf_MemoryError (void ) {
101
+ nlr_raise (mp_obj_new_exception (& mp_type_espidf_MemoryError ));
102
+ }
103
+
86
104
const mp_obj_type_t mp_type_espidf_MemoryError = {
87
105
{ & mp_type_type },
88
106
.name = MP_QSTR_MemoryError ,
@@ -99,6 +117,7 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = {
99
117
{ MP_ROM_QSTR (MP_QSTR_heap_caps_get_free_size ), MP_ROM_PTR (& espidf_heap_caps_get_free_size_obj )},
100
118
{ MP_ROM_QSTR (MP_QSTR_heap_caps_get_largest_free_block ), MP_ROM_PTR (& espidf_heap_caps_get_largest_free_block_obj )},
101
119
120
+ { MP_ROM_QSTR (MP_QSTR_IDFError ), MP_ROM_PTR (& mp_type_espidf_IDFError ) },
102
121
{ MP_ROM_QSTR (MP_QSTR_MemoryError ), MP_ROM_PTR (& mp_type_espidf_MemoryError ) },
103
122
};
104
123
0 commit comments