Thalhammer / jwt-cpp

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

Use common base class for all exceptions thrown by jwt-cpp #215

Open sirzooro opened 2 years ago

sirzooro commented 2 years ago

This was initially described in https://github.com/Thalhammer/jwt-cpp/issues/212. Please add new class derived from std::system_error, and derive all jwt-cpp exceptions from it. This would allow to write bigger block of code, and at the end add few catch sections for different kinds of errors (e.g. network error, jwt validation error, etc.). You also could store some extra information in additional fields of exception class, e.g. name of claim which did not pass validation.

Desktop:

prince-chrismc commented 9 months ago

Extra bit for this is some of the algo families added latter on mix other algo error codes https://github.com/Thalhammer/jwt-cpp/pull/318#issuecomment-1849113137

more possible work in this direction https://github.com/Thalhammer/jwt-cpp/pull/318#pullrequestreview-1777600060