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, but received no feedback.