mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-07 03:57:19 +00:00
tape: improve error on decode element status page
instead of wrapping the function body in a 'try_block', simply move the map_err to the only call site, where we can even add more context than in the function itself. aside from better error output, no functional change intended this could help in debugging cases like this issue reported in the forum: https://forum.proxmox.com/threads/137391/ Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
47da06beed
commit
24bfaa646e
@ -326,7 +326,9 @@ fn get_element<F: AsRawFd>(
|
||||
|
||||
let data = execute_scsi_command(sg_raw, &cmd, "read element status (B8h)", retry)?;
|
||||
|
||||
let page = decode_element_status_page(&data, start_element_address)?;
|
||||
let page = decode_element_status_page(&data, start_element_address).map_err(|err| {
|
||||
format_err!("decode element status for {element_type:?} on {start_element_address} failed - {err}")
|
||||
})?;
|
||||
|
||||
retry = false; // only retry the first command
|
||||
|
||||
@ -679,7 +681,6 @@ fn decode_element_status_page(
|
||||
data: &[u8],
|
||||
start_element_address: u16,
|
||||
) -> Result<DecodedStatusPage, Error> {
|
||||
proxmox_lang::try_block!({
|
||||
let mut result = DecodedStatusPage {
|
||||
last_element_address: None,
|
||||
transports: Vec::new(),
|
||||
@ -820,8 +821,6 @@ fn decode_element_status_page(
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
})
|
||||
.map_err(|err: Error| format_err!("decode element status failed - {}", err))
|
||||
}
|
||||
|
||||
/// Open the device for read/write, returns the file handle
|
||||
|
Loading…
Reference in New Issue
Block a user