mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
fix compiler warning in parseUint and catch only relevant exceptions (#2572)
This commit is contained in:
parent
9c0533a905
commit
e3fc97dffb
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
#include <catch2/internal/catch_parse_numbers.hpp>
|
|
||||||
|
|
||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
#include <catch2/internal/catch_parse_numbers.hpp>
|
||||||
#include <catch2/internal/catch_string_manip.hpp>
|
#include <catch2/internal/catch_string_manip.hpp>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@ -39,11 +39,14 @@ namespace Catch {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return static_cast<unsigned int>(ret);
|
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
|
} // namespace Catch
|
||||||
|
Loading…
Reference in New Issue
Block a user