Closed JerryCheng1 closed 2 years ago
verify throws an exception if the token is invalid, which you are probably not catching anywhere. If an exception is thrown but never caught the runtime calls std::terminate. What you need to do is either catch exceptions thrown by verify, or if you don't want to use exceptions for some reason use the overload that accepts std::error_code as an parameter (which you can them check if it had an error).
This design was made intentional, because the verification can fail for tons of reasons and a simple bool wouldn't give most applications enough information to handle the error correctly.
As mentioned you can avoid the runtimes cost and use the std::error_code
overload.
Closing as answered.
Feel free to reopen if it was unclear
Here is my code: