Browse Source

Merge pull request #229 from dora-rs/refactor-python-error

Refactor python error
tags/v0.2.1-rc
Philipp Oppermann GitHub 2 years ago
parent
commit
86599a243c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions
  1. +1
    -4
      apis/python/node/src/lib.rs
  2. +4
    -1
      binaries/runtime/src/lib.rs
  3. +1
    -1
      binaries/runtime/src/operator/python.rs

+ 1
- 4
apis/python/node/src/lib.rs View File

@@ -104,10 +104,7 @@ impl Node {

#[pyfunction]
fn start_runtime() -> Result<()> {
dora_runtime::main()
.wrap_err("Python Dora Runtime failed.")
.unwrap();
Ok(())
dora_runtime::main().wrap_err("Dora Runtime raised an error.")
}

#[pymodule]


+ 4
- 1
binaries/runtime/src/lib.rs View File

@@ -136,7 +136,10 @@ async fn run(
} => {
match event {
OperatorEvent::Error(err) => {
bail!(err.wrap_err(format!("operator {operator_id} failed")))
bail!(err.wrap_err(format!(
"operator {}/{operator_id} raised an error",
node.id()
)))
}
OperatorEvent::Panic(payload) => {
bail!("operator {operator_id} panicked: {payload:?}");


+ 1
- 1
binaries/runtime/src/operator/python.rs View File

@@ -19,7 +19,7 @@ use tokio::sync::mpsc::Sender;
fn traceback(err: pyo3::PyErr) -> eyre::Report {
let traceback = Python::with_gil(|py| err.traceback(py).and_then(|t| t.format().ok()));
if let Some(traceback) = traceback {
eyre::eyre!("{err}:\n{traceback}")
eyre::eyre!("{err}{traceback}")
} else {
eyre::eyre!("{err}")
}


Loading…
Cancel
Save