diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-04-27 02:12:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 02:12:39 +0200 |
commit | 1054723a4b8bcbfe904980acd2193c0fb2458001 (patch) | |
tree | 68601f834a64b08fc7e1a6428fa3c11c6c329f26 /serde_v8/magic/string_or_buffer.rs | |
parent | 09b6dbc0a63cc55d0f65bd51416a04e577e08490 (diff) |
feat(serde_v8): better error output (#18815)
The type that was received is now printed as part of a message.
Diffstat (limited to 'serde_v8/magic/string_or_buffer.rs')
-rw-r--r-- | serde_v8/magic/string_or_buffer.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/serde_v8/magic/string_or_buffer.rs b/serde_v8/magic/string_or_buffer.rs index 04ce08be2..8b1a06dbc 100644 --- a/serde_v8/magic/string_or_buffer.rs +++ b/serde_v8/magic/string_or_buffer.rs @@ -2,6 +2,7 @@ use super::buffer::ZeroCopyBuf; use super::transl8::FromV8; use super::transl8::ToV8; +use crate::error::value_to_type_str; use crate::magic::transl8::impl_magic; use crate::Error; use std::ops::Deref; @@ -73,7 +74,7 @@ impl FromV8 for StringOrBuffer { } else if let Ok(s) = crate::from_v8(scope, value) { return Ok(Self::String(s)); } - Err(Error::ExpectedBuffer) + Err(Error::ExpectedBuffer(value_to_type_str(value))) } } |