Skip to content

Commit

Permalink
Adjust exception mapping in Potassco::fail().
Browse files Browse the repository at this point in the history
* ERANGE is a logic error and should be mapped to std::out_of_range.
* E2BIG can be mapped to std::length_error.
  • Loading branch information
BenKaufmann committed Mar 25, 2024
1 parent 4c9e27b commit 414bc1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/string_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,11 @@ void fail(int ec, const char* file, unsigned line, const char* exp, const char*
case error_logic : throw std::logic_error(msg);
case error_assert : throw std::logic_error(msg);
case error_runtime: throw std::runtime_error(msg);
case E2BIG : throw std::length_error(msg);
case ENOMEM : throw std::bad_alloc();
case EINVAL : throw std::invalid_argument(msg);
case EDOM : throw std::domain_error(msg);
case ERANGE : throw std::range_error(msg);
case ERANGE : throw std::out_of_range(msg);
#if defined(EOVERFLOW)
case EOVERFLOW : throw std::overflow_error(msg);
#endif
Expand Down

0 comments on commit 414bc1a

Please sign in to comment.