PDS software with bells & whistles you didn’t even know you needed. will move this to its own account when ready.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 16 lines 634 B view raw
1use super::super::OAuthError; 2use serde::{Serialize, de::DeserializeOwned}; 3 4pub fn to_json<T: Serialize>(value: &T) -> Result<serde_json::Value, OAuthError> { 5 serde_json::to_value(value).map_err(|e| { 6 tracing::error!("JSON serialization error: {}", e); 7 OAuthError::ServerError("Internal serialization error".to_string()) 8 }) 9} 10 11pub fn from_json<T: DeserializeOwned>(value: serde_json::Value) -> Result<T, OAuthError> { 12 serde_json::from_value(value).map_err(|e| { 13 tracing::error!("JSON deserialization error: {}", e); 14 OAuthError::ServerError("Internal data corruption".to_string()) 15 }) 16}