diff options
| author | lbckmnn | 2022-12-12 12:15:42 +0100 |
|---|---|---|
| committer | GitHub | 2022-12-12 12:15:42 +0100 |
| commit | e3fc97dffbad63f49a90e5ae688b0ce0c282e8c2 (patch) | |
| tree | 4241372abfbede0e7413cb57802dfcc1c703924c /src/catch2/internal/catch_parse_numbers.cpp | |
| parent | 9c0533a90504b2b1c308dc7cc77ff194f81046e2 (diff) | |
| download | catch3-e3fc97dffbad63f49a90e5ae688b0ce0c282e8c2.tar.gz | |
fix compiler warning in parseUint and catch only relevant exceptions (#2572)
Diffstat (limited to 'src/catch2/internal/catch_parse_numbers.cpp')
| -rw-r--r-- | src/catch2/internal/catch_parse_numbers.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/catch2/internal/catch_parse_numbers.cpp b/src/catch2/internal/catch_parse_numbers.cpp index 390b8c87..d949ac19 100644 --- a/src/catch2/internal/catch_parse_numbers.cpp +++ b/src/catch2/internal/catch_parse_numbers.cpp @@ -6,12 +6,12 @@ // SPDX-License-Identifier: BSL-1.0 -#include <catch2/internal/catch_parse_numbers.hpp> - #include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_parse_numbers.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <limits> +#include <stdexcept> namespace Catch { @@ -39,11 +39,14 @@ namespace Catch { return {}; } return static_cast<unsigned int>(ret); - } CATCH_CATCH_ANON( std::exception const& ) { - // There was a larger issue with the input, e.g. the parsed - // number would be too large to fit within ull. - return {}; } + CATCH_CATCH_ANON( std::invalid_argument const& ) { + // no conversion could be performed + } + CATCH_CATCH_ANON( std::out_of_range const& ) { + // the input does not fit into an unsigned long long + } + return {}; } } // namespace Catch |