Skip to content

Commit

Permalink
Replace usage of ERROR_EMPTY with ERROR_NOT_FOUND (#30761)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq authored and pull[bot] committed Jan 13, 2024
1 parent 5976f26 commit d89483a
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 16 deletions.
1 change: 0 additions & 1 deletion docs/ERROR_CODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ This file was **AUTOMATICALLY** generated by
| 26 | 0x1A | `CHIP_ERROR_DUPLICATE_KEY_ID` |
| 27 | 0x1B | `CHIP_ERROR_WRONG_KEY_TYPE` |
| 28 | 0x1C | `CHIP_ERROR_UNINITIALIZED` |
| 29 | 0x1D | `CHIP_ERROR_EMPTY` |
| 30 | 0x1E | `CHIP_ERROR_INVALID_STRING_LENGTH` |
| 31 | 0x1F | `CHIP_ERROR_INVALID_LIST_LENGTH` |
| 33 | 0x21 | `CHIP_ERROR_END_OF_TLV` |
Expand Down
2 changes: 1 addition & 1 deletion src/lib/address_resolve/AddressResolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class Resolver
/// This method will return CHIP_ERROR_INCORRECT_STATE if the handle is
/// still active.
///
/// This method will return CHIP_ERROR_EMPTY if there are no more
/// This method will return CHIP_ERROR_NOT_FOUND if there are no more
/// results.
///
/// This method may return other errors in some cases.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/address_resolve/AddressResolve_DefaultImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ CHIP_ERROR Resolver::LookupNode(const NodeLookupRequest & request, Impl::NodeLoo
CHIP_ERROR Resolver::TryNextResult(Impl::NodeLookupHandle & handle)
{
VerifyOrReturnError(!mActiveLookups.Contains(&handle), CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(handle.HasLookupResult(), CHIP_ERROR_EMPTY);
VerifyOrReturnError(handle.HasLookupResult(), CHIP_ERROR_NOT_FOUND);

auto listener = handle.GetListener();
auto peerId = handle.GetRequest().GetPeerId();
Expand Down
3 changes: 0 additions & 3 deletions src/lib/core/CHIPError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err)
case CHIP_ERROR_UNINITIALIZED.AsInteger():
desc = "Uninitialized";
break;
case CHIP_ERROR_EMPTY.AsInteger():
desc = "Empty";
break;
case CHIP_ERROR_INVALID_STRING_LENGTH.AsInteger():
desc = "Invalid string length";
break;
Expand Down
9 changes: 1 addition & 8 deletions src/lib/core/CHIPError.h
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,7 @@ using CHIP_ERROR = ::chip::ChipError;
*/
#define CHIP_ERROR_UNINITIALIZED CHIP_CORE_ERROR(0x1c)

/**
* @def CHIP_ERROR_EMPTY
*
* @brief
* A requested object is empty.
*
*/
#define CHIP_ERROR_EMPTY CHIP_CORE_ERROR(0x1d)
// AVAILABLE: 0x1d

/**
* @def CHIP_ERROR_INVALID_STRING_LENGTH
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/tests/TestCHIPErrorStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ static const CHIP_ERROR kTestElements[] =
CHIP_ERROR_DUPLICATE_KEY_ID,
CHIP_ERROR_WRONG_KEY_TYPE,
CHIP_ERROR_UNINITIALIZED,
CHIP_ERROR_EMPTY,
CHIP_ERROR_INVALID_STRING_LENGTH,
CHIP_ERROR_INVALID_LIST_LENGTH,
CHIP_END_OF_TLV,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/shell/commands/Dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DnsShellResolverDelegate : public Dnssd::CommissioningResolveDelegate, pub
// Schedule a retry. Not called directly so we do not recurse in OnNodeAddressResolved
DeviceLayer::SystemLayer().ScheduleLambda([this] {
CHIP_ERROR err = AddressResolve::Resolver::Instance().TryNextResult(Handle());
if (err != CHIP_NO_ERROR && err != CHIP_ERROR_EMPTY)
if (err != CHIP_NO_ERROR && err != CHIP_ERROR_NOT_FOUND)
{
ChipLogError(Discovery, "Failed to list next result: %" CHIP_ERROR_FORMAT, err.Format());
}
Expand Down

0 comments on commit d89483a

Please sign in to comment.