Skip to content

Commit 1ceebdb

Browse files
Always return py error first before checking egglog errors
1 parent 4bcad9a commit 1ceebdb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/egraph.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ impl EGraph {
6464
cmds_str = cmds_str + &cmd.to_string() + "\n";
6565
}
6666
info!("Running commands:\n{}", cmds_str);
67-
match py.detach(|| self.egraph.run_program(commands)) {
67+
let res = py.detach(|| self.egraph.run_program(commands));
68+
if let Some(err) = PyErr::take(py) {
69+
return Err(WrappedError::Py(err));
70+
}
71+
match res {
6872
Err(e) => Err(WrappedError::Egglog(e)),
6973
Ok(outputs) => {
70-
if let Some(err) = PyErr::take(py) {
71-
return Err(WrappedError::Py(err));
72-
}
7374
if let Some(cmds) = &mut self.cmds {
7475
cmds.push_str(&cmds_str);
7576
}

0 commit comments

Comments
 (0)