forked from M-Labs/nac3
nac3artiq: return err instead of panic for host object attribute error
This commit is contained in:
parent
0ec2ed4d91
commit
09820e5aed
|
@ -671,7 +671,10 @@ impl Nac3 {
|
||||||
&mut composer.unifier,
|
&mut composer.unifier,
|
||||||
&self.primitive,
|
&self.primitive,
|
||||||
);
|
);
|
||||||
return Err(CompileError::new_err(msg.unwrap_or(e)));
|
return Err(CompileError::new_err(format!(
|
||||||
|
"compilation failed\n----------\n{}",
|
||||||
|
msg.unwrap_or(e)
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let top_level = Arc::new(composer.make_top_level_context());
|
let top_level = Arc::new(composer.make_top_level_context());
|
||||||
|
|
|
@ -670,7 +670,10 @@ impl InnerResolver {
|
||||||
if let TypeEnum::TFunc(..) = &*unifier.get_ty(field.1.0) {
|
if let TypeEnum::TFunc(..) = &*unifier.get_ty(field.1.0) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
let field_data = obj.getattr(&name)?;
|
let field_data = match obj.getattr(&name) {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(e) => return Ok(Err(format!("{}", e))),
|
||||||
|
};
|
||||||
let ty = match self
|
let ty = match self
|
||||||
.get_obj_type(py, field_data, unifier, defs, primitives)?
|
.get_obj_type(py, field_data, unifier, defs, primitives)?
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue