refactor(bonfire): remove quark dependency

This commit is contained in:
Paul Makles
2024-04-08 21:49:19 +01:00
parent 0fc59b8e2a
commit a1eeedabb9
15 changed files with 1105 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
use async_tungstenite::tungstenite::{handshake, Message};
use futures::channel::oneshot::Sender;
use revolt_quark::{Error, Result};
use revolt_result::{create_error, Result};
use serde::{Deserialize, Serialize};
/// Enumeration of supported protocol formats
@@ -37,16 +37,16 @@ impl ProtocolConfiguration {
match self.format {
ProtocolFormat::Json => {
if let Message::Text(text) = msg {
serde_json::from_str(text).map_err(|_| Error::InternalError)
serde_json::from_str(text).map_err(|_| create_error!(InternalError))
} else {
Err(Error::InternalError)
Err(create_error!(InternalError))
}
}
ProtocolFormat::Msgpack => {
if let Message::Binary(buf) = msg {
rmp_serde::from_slice(buf).map_err(|_| Error::InternalError)
rmp_serde::from_slice(buf).map_err(|_| create_error!(InternalError))
} else {
Err(Error::InternalError)
Err(create_error!(InternalError))
}
}
}