Specifically give a better error message for setlabel on RO fs
This commit is contained in:
parent
fe7f405fc7
commit
9c47fd9c13
|
@ -335,6 +335,9 @@ static mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
|
|||
const char *label_str = mp_obj_str_get_str(label_in);
|
||||
FRESULT res = f_setlabel(&self->fatfs, label_str);
|
||||
if (res != FR_OK) {
|
||||
if(res == FR_WRITE_PROTECTED) {
|
||||
mp_raise_msg(&mp_type_OSError, "Read-only filesystem");
|
||||
}
|
||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||
}
|
||||
return mp_const_none;
|
||||
|
|
Loading…
Reference in New Issue