mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-14 16:58:34 +00:00
Fix a major error in error_code category checking implementations.
Errors some times don't throw exceptions due to implementation differences.
This commit is contained in:
parent
9ff6e50b5e
commit
bef9e9d553
1 changed files with 6 additions and 3 deletions
|
@ -761,7 +761,8 @@ void jwt_throw_exception(const std::error_code& ec)
|
|||
{
|
||||
const auto& cat = ec.category();
|
||||
|
||||
if (&cat == &theVerificationErrorCategory)
|
||||
if (&cat == &theVerificationErrorCategory ||
|
||||
std::string(cat.name()) == std::string(theVerificationErrorCategory.name()))
|
||||
{
|
||||
switch (static_cast<VerificationErrc>(ec.value()))
|
||||
{
|
||||
|
@ -810,7 +811,8 @@ void jwt_throw_exception(const std::error_code& ec)
|
|||
};
|
||||
}
|
||||
|
||||
if (&cat == &theDecodeErrorCategory)
|
||||
if (&cat == &theDecodeErrorCategory ||
|
||||
std::string(cat.name()) == std::string(theDecodeErrorCategory.name()))
|
||||
{
|
||||
switch (static_cast<DecodeErrc>(ec.value()))
|
||||
{
|
||||
|
@ -836,7 +838,8 @@ void jwt_throw_exception(const std::error_code& ec)
|
|||
assert (0 && "Unknown error code");
|
||||
}
|
||||
|
||||
if (&cat == &theAlgorithmErrCategory)
|
||||
if (&cat == &theAlgorithmErrCategory ||
|
||||
std::string(cat.name()) == std::string(theAlgorithmErrCategory.name()))
|
||||
{
|
||||
switch (static_cast<AlgorithmErrc>(ec.value()))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue