With gnupg-2.3, the error string returned when a certificate is not found does not use gpg_err_code(). The result is a poor user experience. The output is:
gpgsm: failed to find the certificate: Not found
as opposed to the gnupg-2.2 output:
gpgsm: certificate not found
A patch is attached. I sent this to gnupg-devel in November[1], but received no feedback.
Thanks.
[1] https://lists.gnupg.org/pipermail/gnupg-devel/2021-November/034991.html