Skip to content

Commit c10e947

Browse files
committed
rafs: unify error code
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 <liub.liubo@gmail.com>
1 parent 365f13e commit c10e947

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl ConfigV2 {
124124
pub fn get_backend_config(&self) -> Result<&BackendConfigV2> {
125125
self.backend.as_ref().ok_or_else(|| {
126126
Error::new(
127-
ErrorKind::InvalidInput,
127+
ErrorKind::InvalidData,
128128
"no configuration information for backend",
129129
)
130130
})
@@ -163,7 +163,7 @@ impl ConfigV2 {
163163
pub fn get_rafs_config(&self) -> Result<&RafsConfigV2> {
164164
self.rafs.as_ref().ok_or_else(|| {
165165
Error::new(
166-
ErrorKind::InvalidInput,
166+
ErrorKind::InvalidData,
167167
"no configuration information for rafs",
168168
)
169169
})

0 commit comments

Comments
 (0)