fix: In Keybase GetByAddress, change generic error to NewErrKeyNotFound #1316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Keybase method
GetByName
returns the specific errorErrKeyNotFound
if the key is not found. This is very nice because the GnoMobile API wraps this with a gRPC function and we usekeyerror.IsErrKeyNotFound
to check the error type and convert it to the gRPC equivalent. But the Keybase methodGetByAddress
just returns a generic error if the key isn't found. (I assume that it is not intentional to restrict this to a generic error.) This means that the gRPC interface must search the error string for "not found", which is unreliable. We would prefer to usekeyerror.IsErrKeyNotFound
. Furthermore,GetByNameOrAddress
can return an error from eitherGetByName
orGetByAddress
. It is preferable to return just one error type for key not found.This pull request updates
GetByAddress
to usekeyerror.NewErrKeyNotFound
with the same error message.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description