Remove duplicated key handlers by prince-chrismc · Pull Request #318 · Thalhammer/jwt-cpp
I like the general idea of cleaning up the error handling, given that rsa_error is kind of wrong if you load an ecdsa key.
However I am not sure if I like the implementation. You are essentially duplicating every key error into ecdsa and rsa and the user has to care about that, even though the underlying error is basically the same. With all the upcoming/planned work towards jwks, key related error cases and codes are only going to get more which makes me feel/wonder if a separate error category for key handling might be a better fit. Especially given a key class would very likely be capable of holding all kinds of keys (rsa, ecdsa, maybe even symetric) and I really don't care which one was inside when I want to convert it to pem.
I am still approving this, since the code on its own looks good and it definitly is better than the current solution. I am just not sure if its the best solution.