Wrap serde json errors
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::error::{Error, Result};
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
//use serde_json::json;
|
||||
//use serde_json::Result;
|
||||
@@ -48,6 +49,13 @@ where
|
||||
// Roundtrip from JSON-string to Event, and back to string.
|
||||
// Perform validation on an Event to ensure the id and signature are correct.
|
||||
|
||||
impl Event {
|
||||
pub fn parse(json: &str) -> Result<Event> {
|
||||
let e: Event = serde_json::from_str(json)?;
|
||||
Err(Error::EventParseFailed)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::event::Event;
|
||||
|
||||
Reference in New Issue
Block a user