fix compiler warning in parseUint and catch only relevant exceptions (#2572)

This commit is contained in:
lbckmnn 2022-12-12 12:15:42 +01:00 committed by GitHub
parent 9c0533a905
commit e3fc97dffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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