Skip to content

Commit

Permalink
don't demote RecoveryErrors
Browse files Browse the repository at this point in the history
RecoveryError hints are not properly forwarded.

Related to #51.
  • Loading branch information
tmplt committed Oct 28, 2021
1 parent 8677734 commit 374555d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ enum Command {
#[derive(Debug, Error)]
pub enum RTICScopeError {
// adhoc errors
// TODO remove?
#[error("Probe setup and/or initialization failed: {0}")]
CommonProbeOperationError(#[from] probe_rs_cli_util::common_options::OperationError),
#[error("I/O operation failed: {0}")]
Expand All @@ -170,6 +169,7 @@ pub enum RTICScopeError {
#[error(transparent)]
SinkError(#[from] sinks::SinkError),

// everything else
#[error(transparent)]
Other(#[from] anyhow::Error),
}
Expand All @@ -188,9 +188,10 @@ impl diag::DiagnosableError for RTICScopeError {

impl RTICScopeError {
pub fn render(&self) {
log::err(format!("{:?}", self));
log::err(format!("{}", self)); // XXX only prints top-level error

// print eventual hints
// XXX should we anyhow::Error::downcast somehow instead?
use crate::diag::DiagnosableError;
type DE = dyn DiagnosableError;
for hint in self.diagnose().iter().chain(
Expand Down Expand Up @@ -536,10 +537,7 @@ fn resolve_maps(
let pacp = pacp::PACProperties::new(cargo, pac)?;

// Map IRQ numbers and DWT matches to their respective RTIC tasks
let maps = recovery::TaskResolver::new(artifact, cargo, pacp)
.context("Failed to parse RTIC application source file")?
.resolve()
.context("Failed to resolve tasks")?;
let maps = recovery::TaskResolver::new(artifact, cargo, pacp)?.resolve()?;

Ok(maps)
}
Expand Down

0 comments on commit 374555d

Please sign in to comment.