From 126ca7a268f0f5e5cb6a431b1ee6df105d4f098e Mon Sep 17 00:00:00 2001 From: Rushmore Mushambi Date: Tue, 16 Apr 2024 10:07:00 +0200 Subject: [PATCH] Drop dependency on `storekey::encode::Error` in the serialiser (#3878) --- core/src/err/mod.rs | 4 ++++ core/src/sql/value/serde/ser/value/mod.rs | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/err/mod.rs b/core/src/err/mod.rs index 2f6df659..ba2f3ac5 100644 --- a/core/src/err/mod.rs +++ b/core/src/err/mod.rs @@ -936,6 +936,10 @@ pub enum Error { /// An error related to live query occurred #[error("Failed to process Live Query: {0}")] LiveQueryError(LiveQueryCause), + + /// The supplied type could not be serialiazed into `sql::Value` + #[error("Serialization error: {0}")] + Serialization(String), } impl From for String { diff --git a/core/src/sql/value/serde/ser/value/mod.rs b/core/src/sql/value/serde/ser/value/mod.rs index 96f0b8bc..2abebe15 100644 --- a/core/src/sql/value/serde/ser/value/mod.rs +++ b/core/src/sql/value/serde/ser/value/mod.rs @@ -35,7 +35,6 @@ use serde::ser::Serialize; use serde::ser::SerializeMap as _; use serde::ser::SerializeSeq as _; use std::fmt::Display; -use storekey::encode::Error as EncodeError; use vec::SerializeValueVec; /// Convert a `T` into `surrealdb::sql::Value` which is an enum that can represent any valid SQL data. @@ -51,7 +50,7 @@ impl serde::ser::Error for Error { where T: Display, { - Self::Encode(EncodeError::Message(msg.to_string())) + Self::Serialization(msg.to_string()) } }