Created
May 17, 2020 10:53
-
-
Save DarkFenX/c36f129fcc8bbf1b4b72d4999167e2a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn _read_json(&self, addr: &PhobosAddress) -> PhobosHandlerResult<JsonValue> { | |
let bytes = match self._read_file(addr) { | |
Ok(bytes) => bytes, | |
Err(e) => { | |
return Err(PhobosHandlerError::new(format!( | |
"{} read failed: {}", | |
addr.get_full_str(&self.base_path), | |
e | |
))) | |
} | |
}; | |
let data = match serde_json::from_slice(&bytes) { | |
Ok(data) => data, | |
Err(e) => { | |
return Err(PhobosHandlerError::new(format!( | |
"{} parsing failed: {}", | |
addr.get_full_str(&self.base_path), | |
e | |
))) | |
} | |
}; | |
Ok(data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment