From 4dfa6e4d3da11ce2740745ef86767f59d513b2d9 Mon Sep 17 00:00:00 2001 From: candifloss Date: Fri, 27 Sep 2024 12:16:31 +0530 Subject: [PATCH] error handling --- src/formats/rson.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formats/rson.rs b/src/formats/rson.rs index ea14252..4609941 100644 --- a/src/formats/rson.rs +++ b/src/formats/rson.rs @@ -3,7 +3,7 @@ use crate::notification::Notification; use rson_rs::ser::to_string as rson_string; impl Notification { - pub fn rson(&self) -> String { - rson_string(&self).unwrap() + pub fn rson(&self) -> Result { + rson_string(self).map_err(|e| format!("Failed to serialize to RSON: {}", e)) } }