StorageBackendError: Use String instead of str in params
This commit is contained in:
parent
f694feacf9
commit
a6054d2223
1 changed files with 12 additions and 12 deletions
|
@ -95,18 +95,18 @@ impl StorageBackend {
|
||||||
let path = self.build_filepath(&f);
|
let path = self.build_filepath(&f);
|
||||||
if let Err(_) = FSFile::open(path) {
|
if let Err(_) = FSFile::open(path) {
|
||||||
return Ok(Err(StorageBackendError::new(
|
return Ok(Err(StorageBackendError::new(
|
||||||
"File::open()",
|
String::from("File::open()"),
|
||||||
&format!("Tried to open '{}'", path)[..],
|
format!("Tried to open '{}'", path),
|
||||||
"Tried to update contents of this file, though file doesn't exist",
|
String::from("Tried to update contents of this file, though file doesn't exist"),
|
||||||
None)))
|
None)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(mut file) = FSFile::create(path) {
|
if let Ok(mut file) = FSFile::create(path) {
|
||||||
if let Err(writeerr) = file.write_all(&content.into_bytes()) {
|
if let Err(writeerr) = file.write_all(&content.into_bytes()) {
|
||||||
return Ok(Err(StorageBackendError::new(
|
return Ok(Err(StorageBackendError::new(
|
||||||
"File::write()",
|
String::from("File::write()"),
|
||||||
&format!("Tried to write '{}'", path)[..],
|
format!("Tried to write '{}'", path),
|
||||||
"Tried to write contents of this file, though operation did not succeed",
|
String::from("Tried to write contents of this file, though operation did not succeed"),
|
||||||
Some(content))))
|
Some(content))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,15 +152,15 @@ pub struct StorageBackendError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StorageBackendError {
|
impl StorageBackendError {
|
||||||
fn new(action: &'static str,
|
fn new(action: String,
|
||||||
desc : &'static str,
|
desc : String,
|
||||||
explan: &'static str,
|
explan: String,
|
||||||
data : Option<String>) -> StorageBackendError
|
data : Option<String>) -> StorageBackendError
|
||||||
{
|
{
|
||||||
StorageBackendError {
|
StorageBackendError {
|
||||||
action: String::from(action),
|
action: action,
|
||||||
desc: String::from(desc),
|
desc: desc,
|
||||||
explanation: String::from(explan),
|
explanation: explan,
|
||||||
dataDump: data,
|
dataDump: data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue