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/u16string.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/u16string.rs')
-rw-r--r-- | serde_v8/magic/u16string.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/serde_v8/magic/u16string.rs b/serde_v8/magic/u16string.rs index 57e3fd0f6..04d742da9 100644 --- a/serde_v8/magic/u16string.rs +++ b/serde_v8/magic/u16string.rs @@ -1,5 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +use crate::error::value_to_type_str; use crate::Error; use super::transl8::impl_magic; @@ -37,7 +38,7 @@ impl FromV8 for U16String { value: v8::Local<v8::Value>, ) -> Result<Self, crate::Error> { let v8str = v8::Local::<v8::String>::try_from(value) - .map_err(|_| Error::ExpectedString)?; + .map_err(|_| Error::ExpectedString(value_to_type_str(value)))?; let len = v8str.length(); let mut buffer = Vec::with_capacity(len); #[allow(clippy::uninit_vec)] |