From a035dd93d2f3873b665c4479c6acf609ee2c4854 Mon Sep 17 00:00:00 2001 From: Yufeng Wang <44623591+yufengwangca@users.noreply.github.com> Date: Fri, 17 Jul 2020 11:36:33 -0700 Subject: [PATCH] Improve CHIP error constant defines to be consistent and accurate (#1640) * Align CHIP error constant name in consistent naming convention * Add CHIP error constants for persistent file access --- src/lib/core/CHIPError.cpp | 19 ++++++-- src/lib/core/CHIPError.h | 48 +++++++++++++++---- src/lib/core/tests/TestCHIPErrorStr.cpp | 4 +- .../TestPersistedStorageImplementation.cpp | 14 +++--- src/platform/Darwin/PosixConfig.cpp | 30 ++++++------ src/platform/Linux/CHIPLinuxStorage.cpp | 4 +- src/platform/Linux/CHIPLinuxStorageIni.cpp | 8 ++-- src/platform/Linux/PosixConfig.cpp | 22 ++++----- 8 files changed, 95 insertions(+), 54 deletions(-) diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index 792bcdb74cc2c4..e132555c4d4dbc 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -225,7 +225,6 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_UNKNOWN_TOPIC: desc = "Unknown Topic"; break; - case CHIP_ERROR_TIMEOUT: desc = "Timeout"; break; @@ -283,7 +282,6 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_UNSUPPORTED_AUTH_MODE: desc = "Unsupported authentication mode"; break; - case CHIP_ERROR_INVALID_SERVICE_EP: desc = "Invalid service endpoint"; break; @@ -305,7 +303,6 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_NO_SW_UPDATE_AVAILABLE: desc = "No SW update available"; break; - case CHIP_ERROR_CA_CERT_NOT_FOUND: desc = "CA certificate not found"; break; @@ -342,7 +339,7 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION: desc = "Unsupported CASE configuration"; break; - case CHIP_ERROR_CERT_LOAD_FAIL: + case CHIP_ERROR_CERT_LOAD_FAILED: desc = "Unable to load certificate"; break; case CHIP_ERROR_CERT_NOT_TRUSTED: @@ -546,7 +543,7 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED: desc = "Default event handler not called"; break; - case CHIP_ERROR_PERSISTED_STORAGE_FAIL: + case CHIP_ERROR_PERSISTED_STORAGE_FAILED: desc = "Persisted storage failed"; break; case CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND: @@ -594,6 +591,18 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, int32_t err) case CHIP_ERROR_INTERNAL: desc = "Internal error"; break; + case CHIP_ERROR_OPEN_FAILED: + desc = "Open file failed"; + break; + case CHIP_ERROR_READ_FAILED: + desc = "Read from file failed"; + break; + case CHIP_ERROR_WRITE_FAILED: + desc = "Write to file failed"; + break; + case CHIP_ERROR_DECODE_FAILED: + desc = "Decoding failed"; + break; } #endif // !CHIP_CONFIG_SHORT_ERROR_STR diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 2eda8d58ec5c6e..520358b08a6b68 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -870,13 +870,13 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; #define CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION _CHIP_ERROR(85) /** - * @def CHIP_ERROR_CERT_LOAD_FAIL + * @def CHIP_ERROR_CERT_LOAD_FAILED * * @brief * A certificate load failed. * */ -#define CHIP_ERROR_CERT_LOAD_FAIL _CHIP_ERROR(86) +#define CHIP_ERROR_CERT_LOAD_FAILED _CHIP_ERROR(86) /** * @def CHIP_ERROR_CERT_NOT_TRUSTED @@ -1531,7 +1531,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * the required elements, or it contais both the MergeData element * and DeletedDictionaryKeyList. */ -#define CHIP_ERROR_MALFORMED_DATA_ELEMENT _CHIP_ERROR(158) +#define CHIP_ERROR_MALFORMED_DATA_ELEMENT _CHIP_ERROR(158) /** * @def CHIP_ERROR_WRONG_CERT_TYPE @@ -1539,7 +1539,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The presented certificate was of the wrong type. */ -#define CHIP_ERROR_WRONG_CERT_TYPE _CHIP_ERROR(159) +#define CHIP_ERROR_WRONG_CERT_TYPE _CHIP_ERROR(159) /** * @def CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED @@ -1551,13 +1551,13 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; #define CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED _CHIP_ERROR(162) /** - * @def CHIP_ERROR_PERSISTED_STORAGE_FAIL + * @def CHIP_ERROR_PERSISTED_STORAGE_FAILED * * @brief * Persisted storage memory read/write failure. * */ -#define CHIP_ERROR_PERSISTED_STORAGE_FAIL _CHIP_ERROR(163) +#define CHIP_ERROR_PERSISTED_STORAGE_FAILED _CHIP_ERROR(163) /** * @def CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND @@ -1668,7 +1668,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * same Trait Instance. * */ -#define CHIP_ERROR_INCONSISTENT_CONDITIONALITY _CHIP_ERROR(179) +#define CHIP_ERROR_INCONSISTENT_CONDITIONALITY _CHIP_ERROR(179) /** * @def CHIP_ERROR_LOCAL_DATA_INCONSISTENT @@ -1678,7 +1678,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Trait Instance and cannot support the operation requested. * */ -#define CHIP_ERROR_LOCAL_DATA_INCONSISTENT _CHIP_ERROR(180) +#define CHIP_ERROR_LOCAL_DATA_INCONSISTENT _CHIP_ERROR(180) /** * @def CHIP_EVENT_ID_FOUND @@ -1696,6 +1696,38 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; */ #define CHIP_ERROR_INTERNAL _CHIP_ERROR(183) +/** + * @def CHIP_ERROR_OPEN_FAILED + * + * @brief + * Open file failed + */ +#define CHIP_ERROR_OPEN_FAILED _CHIP_ERROR(184) + +/** + * @def CHIP_ERROR_READ_FAILED + * + * @brief + * Read from file failed + */ +#define CHIP_ERROR_READ_FAILED _CHIP_ERROR(185) + +/** + * @def CHIP_ERROR_WRITE_FAILED + * + * @brief + * Write to file failed + */ +#define CHIP_ERROR_WRITE_FAILED _CHIP_ERROR(186) + +/** + * @def CHIP_ERROR_DECODE_FAILED + * + * @brief + * Decoding failed + */ +#define CHIP_ERROR_DECODE_FAILED _CHIP_ERROR(187) + /** * @} */ diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index de1587b67118db..cf5c70980fc449 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -135,7 +135,7 @@ static int32_t sContext[] = CHIP_ERROR_CERT_NOT_FOUND, CHIP_ERROR_INVALID_CASE_PARAMETER, CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION, - CHIP_ERROR_CERT_LOAD_FAIL, + CHIP_ERROR_CERT_LOAD_FAILED, CHIP_ERROR_CERT_NOT_TRUSTED, CHIP_ERROR_INVALID_ACCESS_TOKEN, CHIP_ERROR_WRONG_CERT_SUBJECT, @@ -211,7 +211,7 @@ static int32_t sContext[] = CHIP_ERROR_MALFORMED_DATA_ELEMENT, CHIP_ERROR_WRONG_CERT_TYPE, CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED, - CHIP_ERROR_PERSISTED_STORAGE_FAIL, + CHIP_ERROR_PERSISTED_STORAGE_FAILED, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED, CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED, diff --git a/src/lib/support/tests/TestPersistedStorageImplementation.cpp b/src/lib/support/tests/TestPersistedStorageImplementation.cpp index 62801f90d59a41..3d253ca74fb349 100644 --- a/src/lib/support/tests/TestPersistedStorageImplementation.cpp +++ b/src/lib/support/tests/TestPersistedStorageImplementation.cpp @@ -75,14 +75,14 @@ static CHIP_ERROR GetCounterValueFromFile(const char * aKey, uint32_t & aValue) { if (fgets(value, sizeof(value), sPersistentStoreFile) == NULL) { - err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; } else { RemoveEndOfLineSymbol(value); if (!ParseInt(value, aValue, 0)) - err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; } ExitNow(); @@ -115,7 +115,7 @@ static CHIP_ERROR SaveCounterValueToFile(const char * aKey, uint32_t aValue) if (strcmp(key, aKey) == 0) { res = fputs(value, sPersistentStoreFile); - VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); ExitNow(); } @@ -124,13 +124,13 @@ static CHIP_ERROR SaveCounterValueToFile(const char * aKey, uint32_t aValue) // If value not found in the file then write the counter key and // the counter value to the end of the file. res = fputs(aKey, sPersistentStoreFile); - VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); res = fputs("\n", sPersistentStoreFile); - VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); res = fputs(value, sPersistentStoreFile); - VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(res != EOF, err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); exit: fflush(sPersistentStoreFile); @@ -155,7 +155,7 @@ CHIP_ERROR Read(const char * aKey, uint32_t & aValue) VerifyOrExit(it != sPersistentStore.end(), err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); size_t aValueLength = Base64Decode(it->second.c_str(), strlen(it->second.c_str()), (uint8_t *) &aValue); - VerifyOrExit(aValueLength == sizeof(uint32_t), err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(aValueLength == sizeof(uint32_t), err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); } exit: diff --git a/src/platform/Darwin/PosixConfig.cpp b/src/platform/Darwin/PosixConfig.cpp index dd2ad6e8f964ff..caf2ae61aeed93 100644 --- a/src/platform/Darwin/PosixConfig.cpp +++ b/src/platform/Darwin/PosixConfig.cpp @@ -78,7 +78,7 @@ CHIP_ERROR PosixConfig::Init() CHIP_ERROR PosixConfig::ReadConfigValue(Key key, bool & val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -87,7 +87,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, bool & val) CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint32_t & val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -96,7 +96,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint32_t & val) CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint64_t & val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -105,7 +105,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint64_t & val) CHIP_ERROR PosixConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -114,7 +114,7 @@ CHIP_ERROR PosixConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, CHIP_ERROR PosixConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -123,7 +123,7 @@ CHIP_ERROR PosixConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSiz CHIP_ERROR PosixConfig::WriteConfigValue(Key key, bool val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -132,7 +132,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, bool val) CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint32_t val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -141,7 +141,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint32_t val) CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint64_t val) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -150,7 +150,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint64_t val) CHIP_ERROR PosixConfig::WriteConfigValueStr(Key key, const char * str) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -159,7 +159,7 @@ CHIP_ERROR PosixConfig::WriteConfigValueStr(Key key, const char * str) CHIP_ERROR PosixConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -168,7 +168,7 @@ CHIP_ERROR PosixConfig::WriteConfigValueStr(Key key, const char * str, size_t st CHIP_ERROR PosixConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -177,7 +177,7 @@ CHIP_ERROR PosixConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_ CHIP_ERROR PosixConfig::ClearConfigValue(Key key) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -191,7 +191,7 @@ bool PosixConfig::ConfigValueExists(Key key) CHIP_ERROR PosixConfig::EnsureNamespace(const char * ns) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -200,7 +200,7 @@ CHIP_ERROR PosixConfig::EnsureNamespace(const char * ns) CHIP_ERROR PosixConfig::ClearNamespace(const char * ns) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: @@ -209,7 +209,7 @@ CHIP_ERROR PosixConfig::ClearNamespace(const char * ns) CHIP_ERROR PosixConfig::FactoryResetConfig(void) { - CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_FAILED; SuccessOrExit(err); exit: diff --git a/src/platform/Linux/CHIPLinuxStorage.cpp b/src/platform/Linux/CHIPLinuxStorage.cpp index 4f2640febb631c..6501c7eece5efb 100644 --- a/src/platform/Linux/CHIPLinuxStorage.cpp +++ b/src/platform/Linux/CHIPLinuxStorage.cpp @@ -281,7 +281,7 @@ CHIP_ERROR ChipLinuxStorage::ClearAll(void) } else { - retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + retval = CHIP_ERROR_WRITE_FAILED; } return retval; @@ -314,7 +314,7 @@ CHIP_ERROR ChipLinuxStorage::Commit(void) } else { - retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + retval = CHIP_ERROR_WRITE_FAILED; } return retval; diff --git a/src/platform/Linux/CHIPLinuxStorageIni.cpp b/src/platform/Linux/CHIPLinuxStorageIni.cpp index 0c4bd0d08548fa..f98cd84c4dc2e8 100644 --- a/src/platform/Linux/CHIPLinuxStorageIni.cpp +++ b/src/platform/Linux/CHIPLinuxStorageIni.cpp @@ -76,7 +76,7 @@ CHIP_ERROR ChipLinuxStorageIni::AddConfig(const std::string & configFile) else { ChipLogError(DeviceLayer, "Failed to open config file: %s", configFile.c_str()); - retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + retval = CHIP_ERROR_OPEN_FAILED; } return retval; @@ -110,13 +110,13 @@ CHIP_ERROR ChipLinuxStorageIni::CommitConfig(const std::string & configFile) else { ChipLogError(DeviceLayer, "failed to rename (%s), %s (%d)", tmpPath.c_str(), strerror(errno), errno); - retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + retval = CHIP_ERROR_WRITE_FAILED; } } else { ChipLogError(DeviceLayer, "failed to open file (%s) for writing", tmpPath.c_str()); - retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL; + retval = CHIP_ERROR_OPEN_FAILED; } return retval; @@ -291,7 +291,7 @@ CHIP_ERROR ChipLinuxStorageIni::GetBinaryBlobValue(const char * key, uint8_t * d decodedDataLen = Base64Decode(encodedData, encodedDataLen, (uint8_t *) decodedData); if (decodedDataLen == UINT16_MAX || decodedDataLen > expectedDecodedLen) { - retval = CHIP_ERROR_NOT_IMPLEMENTED; + retval = CHIP_ERROR_DECODE_FAILED; } if (encodedData) diff --git a/src/platform/Linux/PosixConfig.cpp b/src/platform/Linux/PosixConfig.cpp index 6b8475f6584829..4cb45cff07c796 100644 --- a/src/platform/Linux/PosixConfig.cpp +++ b/src/platform/Linux/PosixConfig.cpp @@ -102,7 +102,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, bool & val) uint32_t intVal; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->ReadValue(key.Name, intVal); if (err == CHIP_ERROR_KEY_NOT_FOUND) @@ -123,7 +123,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint32_t & val) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->ReadValue(key.Name, val); if (err == CHIP_ERROR_KEY_NOT_FOUND) @@ -142,7 +142,7 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint64_t & val) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Special case the MfrDeviceId value, optionally allowing it to be read as a blob containing // a 64-bit big-endian integer, instead of a u64 value. @@ -177,7 +177,7 @@ CHIP_ERROR PosixConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->ReadValueStr(key.Name, buf, bufSize, outLen); if (err == CHIP_ERROR_KEY_NOT_FOUND) @@ -201,7 +201,7 @@ CHIP_ERROR PosixConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSiz ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->ReadValueBin(key.Name, buf, bufSize, outLen); if (err == CHIP_ERROR_KEY_NOT_FOUND) @@ -225,7 +225,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, bool val) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->WriteValue(key.Name, val ? true : false); SuccessOrExit(err); @@ -246,7 +246,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint32_t val) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->WriteValue(key.Name, val); SuccessOrExit(err); @@ -267,7 +267,7 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint64_t val) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->WriteValue(key.Name, val); SuccessOrExit(err); @@ -290,7 +290,7 @@ CHIP_ERROR PosixConfig::WriteConfigValueStr(Key key, const char * str) if (str != NULL) { storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->WriteValueStr(key.Name, str); SuccessOrExit(err); @@ -341,7 +341,7 @@ CHIP_ERROR PosixConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_ if (data != NULL) { storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->WriteValueBin(key.Name, data, dataLen); SuccessOrExit(err); @@ -368,7 +368,7 @@ CHIP_ERROR PosixConfig::ClearConfigValue(Key key) ChipLinuxStorage * storage; storage = GetStorageForNamespace(key); - VerifyOrExit(storage != NULL, err = CHIP_ERROR_PERSISTED_STORAGE_FAIL); + VerifyOrExit(storage != NULL, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); err = storage->ClearValue(key.Name); if (err == CHIP_ERROR_KEY_NOT_FOUND)