mirror of
https://github.com/espressif/openthread.git
synced 2026-08-08 03:37:46 +00:00
[error] add 'ot::Error' and 'kError{Name}' for use by core modules (#6237)
This commit adds a new core header files `common/error.hpp` which
defines `ot::Error` (mirroring `otError`) and `kError{Name}` constants
(mirroring the public `OT_ERROR_{NAME}` definitions). The new (C++
style) definitions are used by core modules. This commit also moves
`otThreadErrorToString()` (from `logging.hpp` to `error.hpp`) and
renames it to `ErrorToString()` which is used as the internal (to
core) function to covert an `Error` to a string.
This commit is contained in:
+10
-10
@@ -57,8 +57,8 @@ void TestFlash(void)
|
||||
|
||||
// No records in settings
|
||||
|
||||
VerifyOrQuit(flash.Delete(0, 0) == OT_ERROR_NOT_FOUND, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == OT_ERROR_NOT_FOUND, "Get() failed");
|
||||
VerifyOrQuit(flash.Delete(0, 0) == kErrorNotFound, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == kErrorNotFound, "Get() failed");
|
||||
|
||||
// Multiple records with different keys
|
||||
|
||||
@@ -85,8 +85,8 @@ void TestFlash(void)
|
||||
|
||||
for (uint16_t key = 0; key < 16; key++)
|
||||
{
|
||||
VerifyOrQuit(flash.Delete(key, 0) == OT_ERROR_NOT_FOUND, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(key, 0, nullptr, nullptr) == OT_ERROR_NOT_FOUND, "Get() failed");
|
||||
VerifyOrQuit(flash.Delete(key, 0) == kErrorNotFound, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(key, 0, nullptr, nullptr) == kErrorNotFound, "Get() failed");
|
||||
}
|
||||
|
||||
// Multiple records with the same key
|
||||
@@ -112,8 +112,8 @@ void TestFlash(void)
|
||||
SuccessOrQuit(flash.Delete(0, 0), "Delete() failed");
|
||||
}
|
||||
|
||||
VerifyOrQuit(flash.Delete(0, 0) == OT_ERROR_NOT_FOUND, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == OT_ERROR_NOT_FOUND, "Get() failed");
|
||||
VerifyOrQuit(flash.Delete(0, 0) == kErrorNotFound, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == kErrorNotFound, "Get() failed");
|
||||
|
||||
// Multiple records with the same key
|
||||
|
||||
@@ -145,8 +145,8 @@ void TestFlash(void)
|
||||
SuccessOrQuit(flash.Delete(0, 0), "Delete() failed");
|
||||
}
|
||||
|
||||
VerifyOrQuit(flash.Delete(0, 0) == OT_ERROR_NOT_FOUND, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == OT_ERROR_NOT_FOUND, "Get() failed");
|
||||
VerifyOrQuit(flash.Delete(0, 0) == kErrorNotFound, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(0, 0, nullptr, nullptr) == kErrorNotFound, "Get() failed");
|
||||
|
||||
// Wipe()
|
||||
|
||||
@@ -161,8 +161,8 @@ void TestFlash(void)
|
||||
|
||||
for (uint16_t key = 0; key < 16; key++)
|
||||
{
|
||||
VerifyOrQuit(flash.Delete(key, 0) == OT_ERROR_NOT_FOUND, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(key, 0, nullptr, nullptr) == OT_ERROR_NOT_FOUND, "Get() failed");
|
||||
VerifyOrQuit(flash.Delete(key, 0) == kErrorNotFound, "Delete() failed");
|
||||
VerifyOrQuit(flash.Get(key, 0, nullptr, nullptr) == kErrorNotFound, "Get() failed");
|
||||
}
|
||||
|
||||
// Test swap
|
||||
|
||||
Reference in New Issue
Block a user