Skip to content

Commit

Permalink
Improved memory error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jounathaen committed Nov 21, 2024
1 parent b32afc8 commit 06d18a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,15 @@ impl FromStr for Output {
#[derive(Error, Debug)]
pub enum InvalidGuestMemorySizeError {
#[error(
"Not enough guest memory. Must be at least {min} (is {0})",
min = GuestMemorySize::minimum()
"Not enough guest memory. Must be at least {min:#} (is {cur:#.3})",
min = GuestMemorySize::minimum().get_adjusted_unit(Unit::MiB),
cur = .0.get_adjusted_unit(Unit::MiB),
)]
MemoryTooSmall(Byte),
#[error("Invalid amount of guest memory. Must be a multiple of 2 MiB (is {0})")]
#[error(
"Invalid amount of guest memory. Must be a multiple of 2 MiB (is {cur:#.3})",
cur = .0.get_adjusted_unit(Unit::MiB),
)]
NotAHugepage(Byte),
}

Expand Down

0 comments on commit 06d18a1

Please sign in to comment.