Skip to content

Commit

Permalink
rafs: unify error code
Browse files Browse the repository at this point in the history
Based on the error definition, InvalidData is preferable than InvalidInput.

Data not valid for the operation were encountered.
Unlike [InvalidInput], this typically means that the operation parameters were valid, however the error was caused by malformed input data.
For example, a function that reads a file into a string will error with InvalidData if the file's contents are not valid UTF-8.

Signed-off-by: Liu Bo <[email protected]>
  • Loading branch information
liubogithub committed Dec 13, 2024
1 parent b175fc4 commit f9b340b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl ConfigV2 {
pub fn get_backend_config(&self) -> Result<&BackendConfigV2> {
self.backend.as_ref().ok_or_else(|| {
Error::new(
ErrorKind::InvalidInput,
ErrorKind::InvalidData,
"no configuration information for backend",
)
})
Expand Down Expand Up @@ -163,7 +163,7 @@ impl ConfigV2 {
pub fn get_rafs_config(&self) -> Result<&RafsConfigV2> {
self.rafs.as_ref().ok_or_else(|| {
Error::new(
ErrorKind::InvalidInput,
ErrorKind::InvalidData,
"no configuration information for rafs",
)
})
Expand Down

0 comments on commit f9b340b

Please sign in to comment.