mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Improve error messages when extools is disabled
This commit is contained in:
parent
2125c0c417
commit
dfb77db16e
1 changed files with 20 additions and 3 deletions
|
|
@ -179,15 +179,19 @@ handle_request! {
|
|||
if let Some(thread) = extools.get_thread(params.threadId) {
|
||||
return Ok(StackTraceResponse {
|
||||
totalFrames: Some(thread.call_stack.len() as i64),
|
||||
stackFrames: thread.call_stack.into_iter().map(|name| StackFrame {
|
||||
stackFrames: thread.call_stack.into_iter().enumerate().map(|(i, name)| StackFrame {
|
||||
name,
|
||||
// TODO: id, source, line
|
||||
id: i as i64,
|
||||
// TODO: source, line
|
||||
.. Default::default()
|
||||
}).collect(),
|
||||
});
|
||||
} else {
|
||||
return Err(GenericError("Bad thread ID passed"));
|
||||
}
|
||||
} else {
|
||||
return Err(GenericError("No extools connection"));
|
||||
}
|
||||
return Err(Box::new(std::io::Error::from(std::io::ErrorKind::InvalidData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -246,6 +250,19 @@ impl SequenceNumber {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct GenericError(&'static str);
|
||||
|
||||
impl Error for GenericError {
|
||||
fn description(&self) -> &str { self.0 }
|
||||
}
|
||||
|
||||
impl std::fmt::Display for GenericError {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
fmt.write_str(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Implementation-specific DAP extensions.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue