Check that raise command raises exception type

This commit is contained in:
Windel Bouwman
2018-08-26 00:30:01 +02:00
parent c41370a26f
commit a0edc4203f
11 changed files with 87 additions and 59 deletions

View File

@@ -16,6 +16,9 @@ fn bind_method(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
fn member_get(vm: &mut VirtualMachine, mut args: PyFuncArgs) -> PyResult {
match args.shift().get_attr("function") {
Some(function) => vm.invoke(function, args),
None => Err(vm.new_exception(String::from("Attribute Error"))),
None => {
let attribute_error = vm.context().exceptions.attribute_error.clone();
Err(vm.new_exception(attribute_error, String::from("Attribute Error")))
}
}
}