mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: vmm: streamline error Display::fmt()
The changes were mostly automatically applied using the following
Python script:
```python
import os, re
for root, _, files in os.walk("."):
for f in files:
if not f.endswith(".rs"):
continue
p = os.path.join(root, f)
with open(p, "r", encoding="utf-8") as file:
lines = file.readlines()
changed = False
for i in range(len(lines) - 1):
if re.search(r'#\[error\(".*: \{0[^}]*\}"\)\]', lines[i]) and "#[source]" in lines[i + 1].strip():
lines[i] = re.sub(r': \{0[^}]*\}"\)\]', '")]', lines[i])
changed = True
if changed:
with open(p, "w", encoding="utf-8") as file:
file.writelines(lines)
print("Fixed:", p)
```
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
# Conflicts:
# vmm/src/api/http/mod.rs
This commit is contained in:
committed by
Rob Bradford
parent
4987d63b6a
commit
d7edd9d51f
+12
-12
@@ -38,21 +38,21 @@ type ArchUsize = u64;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DebuggableError {
|
||||
#[error("Setting debug failed: {0}")]
|
||||
#[error("Setting debug failed")]
|
||||
SetDebug(#[source] hypervisor::HypervisorCpuError),
|
||||
#[error("Pausing failed: {0}")]
|
||||
#[error("Pausing failed")]
|
||||
Pause(#[source] vm_migration::MigratableError),
|
||||
#[error("Resuming failed: {0}")]
|
||||
#[error("Resuming failed")]
|
||||
Resume(#[source] vm_migration::MigratableError),
|
||||
#[error("Reading registers failed: {0}")]
|
||||
#[error("Reading registers failed")]
|
||||
ReadRegs(#[source] crate::cpu::Error),
|
||||
#[error("Writing registers failed: {0}")]
|
||||
#[error("Writing registers failed")]
|
||||
WriteRegs(#[source] crate::cpu::Error),
|
||||
#[error("Reading memory failed: {0}")]
|
||||
#[error("Reading memory failed")]
|
||||
ReadMem(#[source] GuestMemoryError),
|
||||
#[error("Writing memory failed: {0}")]
|
||||
#[error("Writing memory failed")]
|
||||
WriteMem(#[source] GuestMemoryError),
|
||||
#[error("Translating GVA failed: {0}")]
|
||||
#[error("Translating GVA failed")]
|
||||
TranslateGva(#[source] crate::cpu::Error),
|
||||
#[error("The lock is poisened")]
|
||||
PoisonedState,
|
||||
@@ -92,15 +92,15 @@ pub trait Debuggable: vm_migration::Pausable {
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("VM failed: {0}")]
|
||||
#[error("VM failed")]
|
||||
Vm(#[source] crate::vm::Error),
|
||||
#[error("GDB request failed")]
|
||||
GdbRequest,
|
||||
#[error("GDB couldn't be notified: {0}")]
|
||||
#[error("GDB couldn't be notified")]
|
||||
GdbResponseNotify(#[source] std::io::Error),
|
||||
#[error("GDB response failed: {0}")]
|
||||
#[error("GDB response failed")]
|
||||
GdbResponse(#[source] mpsc::RecvError),
|
||||
#[error("GDB response timeout: {0}")]
|
||||
#[error("GDB response timeout")]
|
||||
GdbResponseTimeout(#[source] mpsc::RecvTimeoutError),
|
||||
}
|
||||
type GdbResult<T> = std::result::Result<T, Error>;
|
||||
|
||||
Reference in New Issue
Block a user