From 6608c16f4636fb791cf5d9189780ad5b0fe3f5c1 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Thu, 18 Jun 2020 12:04:51 +0800 Subject: [PATCH] Config: Renamed ConfigNotFound into KeyNotFoundError. --- src/runtime/src/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/src/config.rs b/src/runtime/src/config.rs index ab8cf1c..55b9d59 100644 --- a/src/runtime/src/config.rs +++ b/src/runtime/src/config.rs @@ -10,7 +10,7 @@ pub enum Error<'a> { SdError(sdio::sd_card::CardInitializationError), IoError(io::Error), Utf8Error(FromUtf8Error), - ConfigNotFound(&'a str), + KeyNotFoundError(&'a str), } pub type Result<'a, T> = core::result::Result>; @@ -21,7 +21,7 @@ impl<'a> fmt::Display for Error<'a> { Error::SdError(error) => write!(f, "SD error: {}", error), Error::IoError(error) => write!(f, "I/O error: {}", error), Error::Utf8Error(error) => write!(f, "UTF-8 error: {}", error), - Error::ConfigNotFound(name) => write!(f, "Config `{}` not found", name), + Error::KeyNotFoundError(name) => write!(f, "Configuration key `{}` not found", name), } } } @@ -57,7 +57,7 @@ fn parse_config<'a>( return Ok(()); } } - Err(Error::ConfigNotFound(key)) + Err(Error::KeyNotFoundError(key)) } pub struct Config { @@ -84,7 +84,7 @@ impl Config { Ok(mut f) => f.read_to_end(&mut buffer).map(|v| ())?, Err(_) => match root_dir.open_file("/CONFIG.TXT") { Ok(f) => parse_config(key, &mut buffer, f)?, - Err(_) => return Err(Error::ConfigNotFound(key)), + Err(_) => return Err(Error::KeyNotFoundError(key)), }, }; Ok(buffer)