Skip to content

Commit 7e4c6d7

Browse files
committed
chore: better naming for caught devnet retryable error
1 parent e7bd46e commit 7e4c6d7

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mod runner;
22

3-
pub use runner::{Devnet, DevnetBootstrapArgs, DevnetTopology, PoolNode, UnrecoverableDevnetError};
3+
pub use runner::{Devnet, DevnetBootstrapArgs, DevnetTopology, PoolNode, RetryableDevnetError};

mithril-test-lab/mithril-end-to-end/src/devnet/runner.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use thiserror::Error;
1010
use tokio::process::Command;
1111

1212
#[derive(Error, Debug, PartialEq, Eq)]
13-
#[error("Unrecoverable devnet error: `{0}`")]
14-
pub struct UnrecoverableDevnetError(pub String);
13+
#[error("Retryable devnet error: `{0}`")]
14+
pub struct RetryableDevnetError(pub String);
1515

1616
#[derive(Debug, Clone, Default)]
1717
pub struct Devnet {
@@ -216,7 +216,7 @@ impl Devnet {
216216
.with_context(|| "Error while starting the devnet")?;
217217
match status.code() {
218218
Some(0) => Ok(()),
219-
Some(code) => Err(anyhow!(UnrecoverableDevnetError(format!(
219+
Some(code) => Err(anyhow!(RetryableDevnetError(format!(
220220
"Run devnet exited with status code: {code}"
221221
)))),
222222
None => Err(anyhow!("Run devnet terminated by signal")),
@@ -265,7 +265,7 @@ impl Devnet {
265265
.with_context(|| "Error while delegating stakes to the pools")?;
266266
match status.code() {
267267
Some(0) => Ok(()),
268-
Some(code) => Err(anyhow!(UnrecoverableDevnetError(format!(
268+
Some(code) => Err(anyhow!(RetryableDevnetError(format!(
269269
"Delegating stakes exited with status code: {code}"
270270
)))),
271271
None => Err(anyhow!("Delegating stakes terminated by signal")),
@@ -291,7 +291,7 @@ impl Devnet {
291291
.with_context(|| "Error while writing era marker on chain")?;
292292
match status.code() {
293293
Some(0) => Ok(()),
294-
Some(code) => Err(anyhow!(UnrecoverableDevnetError(format!(
294+
Some(code) => Err(anyhow!(RetryableDevnetError(format!(
295295
"Write era marker on chain exited with status code: {code}"
296296
)))),
297297
None => Err(anyhow!("Write era marker on chain terminated by signal")),
@@ -317,7 +317,7 @@ impl Devnet {
317317
.with_context(|| "Error while to transferring funds on chain")?;
318318
match status.code() {
319319
Some(0) => Ok(()),
320-
Some(code) => Err(anyhow!(UnrecoverableDevnetError(format!(
320+
Some(code) => Err(anyhow!(RetryableDevnetError(format!(
321321
"Transfer funds on chain exited with status code: {code}"
322322
)))),
323323
None => Err(anyhow!("Transfer funds on chain terminated by signal")),

mithril-test-lab/mithril-end-to-end/src/main.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use tokio::{
1818
use mithril_common::StdResult;
1919
use mithril_doc::GenerateDocCommands;
2020
use mithril_end_to_end::{
21-
Devnet, DevnetBootstrapArgs, MithrilInfrastructure, MithrilInfrastructureConfig, RunOnly, Spec,
22-
UnrecoverableDevnetError,
21+
Devnet, DevnetBootstrapArgs, MithrilInfrastructure, MithrilInfrastructureConfig,
22+
RetryableDevnetError, RunOnly, Spec,
2323
};
2424

2525
/// Tests args
@@ -257,7 +257,7 @@ impl From<StdResult<()>> for AppResult {
257257
match result {
258258
Ok(()) => AppResult::Success(),
259259
Err(error) => {
260-
if error.is::<UnrecoverableDevnetError>() {
260+
if error.is::<RetryableDevnetError>() {
261261
AppResult::RetryableError(error)
262262
} else {
263263
AppResult::UnretryableError(error)
@@ -466,9 +466,7 @@ mod tests {
466466
assert!(matches!(AppResult::from(Ok(())), AppResult::Success()));
467467

468468
assert!(matches!(
469-
AppResult::from(Err(anyhow!(UnrecoverableDevnetError(
470-
"an error".to_string()
471-
)))),
469+
AppResult::from(Err(anyhow!(RetryableDevnetError("an error".to_string())))),
472470
AppResult::RetryableError(_)
473471
));
474472

0 commit comments

Comments
 (0)