modffi: Don't use OSError for clearly unrelated errors.

This commit is contained in:
Paul Sokolovsky 2014-04-21 23:51:58 +03:00
parent 88972b0d94
commit b418b6fb0d
1 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,7 @@ STATIC ffi_type *get_ffi_type(mp_obj_t o_in)
}
// TODO: Support actual libffi type objects
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Unknown type"));
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "Unknown type"));
}
STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
@ -163,7 +163,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) {
int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
if (res != FFI_OK) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error in ffi_prep_cif"));
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
}
return o;
@ -200,12 +200,12 @@ STATIC mp_obj_t mod_ffi_callback(mp_obj_t rettype_in, mp_obj_t func_in, mp_obj_t
int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
if (res != FFI_OK) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error in ffi_prep_cif"));
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
}
res = ffi_prep_closure_loc(o->clo, &o->cif, call_py_func, func_in, o->func);
if (res != FFI_OK) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "ffi_prep_closure_loc"));
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "ffi_prep_closure_loc"));
}
return o;