aboutsummaryrefslogtreecommitdiff
path: root/src/subscription.rs
diff options
context:
space:
mode:
authorLibravatar Daniel López Azaña <daniloaz@gmail.com>2024-04-07 20:24:35 +0200
committerLibravatar Daniel López Azaña <daniloaz@gmail.com>2024-04-07 20:24:35 +0200
commit01b70468fc1a6f7275460bfd414cdf595070522f (patch)
tree051ec102222fd1f1e3c625961364fd8aa29d4c86 /src/subscription.rs
parent2883c5e0503e1494ddbbba2d1bc871ee36acb38d (diff)
✨ (Cargo.toml): bump version to 0.1.5 for new release
✨ (ls_client.rs): add TLCP_VERSION constant for protocol version tracking ♻️ (ls_client.rs): remove commented-out code and unused println for cleaner codebase ♻️ (ls_client.rs): use TLCP_VERSION constant instead of hardcoded protocol string ✨ (ls_client.rs): handle 'reqok' server message for better server communication ♻️ (subscription.rs): change error type to Box<dyn Error> for more generic error handling 🐛 (subscription.rs): fix error message to be more descriptive when items or fields are missing
Diffstat (limited to 'src/subscription.rs')
-rw-r--r--src/subscription.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/subscription.rs b/src/subscription.rs
index e008804..07c580c 100644
--- a/src/subscription.rs
+++ b/src/subscription.rs
@@ -1,5 +1,6 @@
use crate::subscription_listener::SubscriptionListener;
use std::collections::HashMap;
+use std::error::Error;
use std::fmt::{self, Debug, Formatter};
/// Enum representing the snapshot delivery preferences to be requested to Lightstreamer Server for the items in the Subscription.
@@ -116,9 +117,9 @@ impl Subscription {
mode: SubscriptionMode,
items: Option<Vec<String>>,
fields: Option<Vec<String>>,
- ) -> Result<Subscription, String> {
+ ) -> Result<Subscription, Box<dyn Error>> {
if items.is_none() || fields.is_none() {
- return Err("Items and fields must be provided".to_string());
+ return Err("Items and fields must be provided".to_string().into());
}
Ok(Subscription {