Print value that can't be coerced to u32

This commit is contained in:
Sergey Pepyakin 2019-04-17 18:19:18 +02:00
parent ddbeba0154
commit cd34cc6afb
1 changed files with 8 additions and 4 deletions

View File

@ -113,13 +113,17 @@ impl MemoryInstance {
let initial_u32: u32 = initial
.0
.try_into()
.map_err(|_| Error::Memory("initial can't be coerced to u32".into()))?;
.map_err(|_| Error::Memory(format!("initial ({}) can't be coerced to u32", initial.0)))?;
let maximum_u32: Option<u32> = match maximum {
Some(pages) => Some(
pages
Some(maximum_pages) => Some(
maximum_pages
.0
.try_into()
.map_err(|_| Error::Memory("maximum can't be coerced to u32".into()))?,
.map_err(|_|
Error::Memory(
format!("maximum ({}) can't be coerced to u32", maximum_pages.0)
)
)?,
),
None => None,
};