Skip to content

Commit

Permalink
Remove DbusErrorEnum::INTERNAL_ERROR
Browse files Browse the repository at this point in the history
What is an internal error versus just an error? It sounds scarier, as if
it was unanticipated, perhaps.

Best to just use ERROR.

fixes stratis-storage#1181

Signed-off-by: Andy Grover <[email protected]>
  • Loading branch information
Andy Grover committed Sep 17, 2018
1 parent 835b995 commit 2cb6cec
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/dbus_api/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn rename_filesystem(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
"pool {} doesn't know about filesystem {}",
pool_uuid, filesystem_data.uuid
);
let (rc, rs) = (u16::from(DbusErrorEnum::INTERNAL_ERROR), error_message);
let (rc, rs) = (u16::from(DbusErrorEnum::ERROR), error_message);
return_message.append3(default_return, rc, rs)
}
Ok(RenameAction::Identity) => {
Expand Down
6 changes: 3 additions & 3 deletions src/dbus_api/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro_rules! get_data {
data
} else {
let message = format!("no data for object path {}", $path.get_name());
let (rc, rs) = (u16::from(DbusErrorEnum::INTERNAL_ERROR), message);
let (rc, rs) = (u16::from(DbusErrorEnum::ERROR), message);
return Ok(vec![$message.append3($default, rc, rs)]);
}
};
Expand All @@ -24,7 +24,7 @@ macro_rules! get_parent {
parent
} else {
let message = format!("no path for object path {}", $data.parent);
let (rc, rs) = (u16::from(DbusErrorEnum::INTERNAL_ERROR), message);
let (rc, rs) = (u16::from(DbusErrorEnum::ERROR), message);
return Ok(vec![$message.append3($default, rc, rs)]);
}
};
Expand All @@ -37,7 +37,7 @@ macro_rules! get_mut_pool {
pool
} else {
let message = format!("engine does not know about pool with uuid {}", $uuid);
let (rc, rs) = (u16::from(DbusErrorEnum::INTERNAL_ERROR), message);
let (rc, rs) = (u16::from(DbusErrorEnum::ERROR), message);
return Ok(vec![$message.append3($default, rc, rs)]);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/dbus_api/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn rename_pool(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
{
Ok(RenameAction::NoSource) => {
let error_message = format!("engine doesn't know about pool {}", &pool_uuid);
let (rc, rs) = (u16::from(DbusErrorEnum::INTERNAL_ERROR), error_message);
let (rc, rs) = (u16::from(DbusErrorEnum::ERROR), error_message);
return_message.append3(default_return, rc, rs)
}
Ok(RenameAction::Identity) => return_message.append3(false, msg_code_ok(), msg_string_ok()),
Expand Down
2 changes: 0 additions & 2 deletions src/dbus_api/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ macro_attr! {
ALREADY_EXISTS,
BUSY,
IO_ERROR,
INTERNAL_ERROR,
NIX_ERROR,
NOTFOUND,
}
Expand All @@ -44,7 +43,6 @@ impl DbusErrorEnum {
DbusErrorEnum::ERROR => "A general error happened",
DbusErrorEnum::ALREADY_EXISTS => "Already exists",
DbusErrorEnum::BUSY => "Operation can not be performed at this time",
DbusErrorEnum::INTERNAL_ERROR => "Internal error",
DbusErrorEnum::IO_ERROR => "IO error during operation",
DbusErrorEnum::NIX_ERROR => "System error during operation",
DbusErrorEnum::NOTFOUND => "Not found",
Expand Down
4 changes: 2 additions & 2 deletions src/dbus_api/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ where
/// D-Bus methods return.
pub fn engine_to_dbus_err_tuple(err: &StratisError) -> (u16, String) {
let error = match *err {
StratisError::Error(_) => DbusErrorEnum::INTERNAL_ERROR,
StratisError::Error(_) => DbusErrorEnum::ERROR,
StratisError::Engine(ref e, _) => match *e {
ErrorEnum::Error => DbusErrorEnum::ERROR,
ErrorEnum::AlreadyExists => DbusErrorEnum::ALREADY_EXISTS,
Expand All @@ -60,7 +60,7 @@ pub fn engine_to_dbus_err_tuple(err: &StratisError) -> (u16, String) {
| StratisError::Serde(_)
| StratisError::DM(_)
| StratisError::Dbus(_)
| StratisError::Udev(_) => DbusErrorEnum::INTERNAL_ERROR,
| StratisError::Udev(_) => DbusErrorEnum::ERROR,
};
let description = match *err {
StratisError::DM(DmError::Core(ref err)) => err.to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ class StratisdErrors(IntEnum):
ALREADY_EXISTS = 2
BUSY = 3
IO_ERROR = 4
INTERNAL_ERROR = 5
NIX_ERROR = 6
NOT_FOUND = 7
NIX_ERROR = 5
NOT_FOUND = 6

0 comments on commit 2cb6cec

Please sign in to comment.