Remove explanation member of StorageBackendError to reduce complexibility

This commit is contained in:
Matthias Beyer 2015-11-28 16:07:33 +01:00
parent 83aa5afcbe
commit 144398a2ad

View file

@ -125,7 +125,7 @@ impl StorageBackend {
let mut err = StorageBackendError::build( let mut err = StorageBackendError::build(
"File::write_all()", "File::write_all()",
"Could not write out File contents", "Could not write out File contents",
"", None None
); );
err.caused_by = Some(Box::new(ioerr)); err.caused_by = Some(Box::new(ioerr));
err err
@ -135,7 +135,7 @@ impl StorageBackend {
let mut err = StorageBackendError::build( let mut err = StorageBackendError::build(
"File::create()", "File::create()",
"Creating file on disk failed", "Creating file on disk failed",
"", None None
); );
err.caused_by = Some(Box::new(writeerr)); err.caused_by = Some(Box::new(writeerr));
err err
@ -164,7 +164,6 @@ impl StorageBackend {
debug!("Could not write file"); debug!("Could not write file");
let mut err = StorageBackendError::build( let mut err = StorageBackendError::build(
"File::write()", "File::write()",
"",
"Tried to write contents of this file, though operation did not succeed", "Tried to write contents of this file, though operation did not succeed",
Some(string) Some(string)
); );
@ -175,7 +174,6 @@ impl StorageBackend {
debug!("Could not write file at '{}'", path); debug!("Could not write file at '{}'", path);
let mut err = StorageBackendError::build( let mut err = StorageBackendError::build(
"File::open()", "File::open()",
"",
"Tried to update contents of this file, though file doesn't exist", "Tried to update contents of this file, though file doesn't exist",
None None
); );
@ -253,7 +251,7 @@ pub struct StorageBackendError {
impl StorageBackendError { impl StorageBackendError {
fn new(action: String, fn new(action: String,
desc : String, desc : String,
data : Option<String>) -> StorageBackendError<'a> data : Option<String>) -> StorageBackendError
{ {
StorageBackendError { StorageBackendError {
action: action, action: action,
@ -265,7 +263,7 @@ impl StorageBackendError {
fn build(action: &'static str, fn build(action: &'static str,
desc: &'static str, desc: &'static str,
data : Option<String>) -> StorageBackendError<'a> data : Option<String>) -> StorageBackendError
{ {
StorageBackendError { StorageBackendError {
action: String::from(action), action: String::from(action),
@ -304,7 +302,6 @@ fn write_with_parser<'a, HP>(f: &File, p: &Parser<HP>) -> Result<String, Storage
.or_else(|err| { .or_else(|err| {
let mut serr = StorageBackendError::build( let mut serr = StorageBackendError::build(
"Parser::write()", "Parser::write()",
"Cannot parse file contents",
"Cannot translate internal representation of file contents into on-disk representation", "Cannot translate internal representation of file contents into on-disk representation",
None None
); );