Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
855 stars 233 forks source link

Exception-free? #294

Closed Bolderaysky closed 1 year ago

Bolderaysky commented 1 year ago

What would you like to see added?

Build with -fno-exceptions

Additional Context

I'm developing project with disabled exception handling and I had some thoughts on using this lib for JWT, but it looks like this jwt-cpp make use of exceptions for error handling. What do you think about adding ability to disable exception handling, for example, through preprocessor definition, something like JWT_NO_EXCEPTIONS, which would change model of error handling? Also, this can be beneficial as this change would allow to build and use this lib on microcontrollers (not sure about using openssl in such case, but wolfssl mostly should handle such cases and as far as I know it's supported).

Bolderaysky commented 1 year ago

Ahhh, sorry, found that exceptions come from json libraries used and picojson has PICOJSON_NOEXCEPT definition. Closing this as it was not an issue at all.

prince-chrismc commented 1 year ago

There are code paths with exceptions which are mostly avoidable, however it would be great to see more of the API update to use error_code