[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:
Abtin Keshavarzian
2021-03-15 21:07:07 -07:00
committed by GitHub
parent e992b8461c
commit 7dca56e982
255 changed files with 7171 additions and 7057 deletions
+1 -2
View File
@@ -169,8 +169,7 @@ void TestEdsaKeyGenerationSignAndVerify(void)
sha256.Start();
sha256.Update(kMessage, sizeof(kMessage)); // include null char
sha256.Finish(hash);
VerifyOrQuit(publicKey.Verify(hash, signature) != OT_ERROR_NONE,
"PublicKey::Verify() passed for invalid signature");
VerifyOrQuit(publicKey.Verify(hash, signature) != kErrorNone, "PublicKey::Verify() passed for invalid signature");
printf("\nSignature verification correctly failed with incorrect hash/signature.\n\n");
testFreeInstance(instance);