error handling
This commit is contained in:
parent
a6b95bad57
commit
4dfa6e4d3d
@ -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<String, String> {
|
||||
rson_string(self).map_err(|e| format!("Failed to serialize to RSON: {}", e))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user