forked from boostorg/beast
Add file and line number to thrown exceptions
This commit is contained in:
1 parent
e66327ed4d
commit
cfde28c3c3
12 files changed
+80
-34
No files matched your search
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <beast/zlib/zlib.hpp>
|
||||
#include <beast/zlib/detail/ranges.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <cstdint>
|
||||
@@ -893,14 +894,19 @@ doReset(
|
||||
if(windowBits == 8)
|
||||
windowBits = 9;
|
||||
|
||||
using beast::detail::make_exception;
|
||||
|
||||
if(level < 0 || level > 9)
|
||||
throw std::invalid_argument{"invalid level"};
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"invalid level", __FILE__, __LINE__);
|
||||
|
||||
if(windowBits < 8 || windowBits > 15)
|
||||
throw std::invalid_argument{"invalid windowBits"};
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"invalid windowBits", __FILE__, __LINE__);
|
||||
|
||||
if(memLevel < 1 || memLevel > MAX_MEM_LEVEL)
|
||||
throw std::invalid_argument{"invalid memLevel"};
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"invalid memLevel", __FILE__, __LINE__);
|
||||
|
||||
w_bits_ = windowBits;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <beast/zlib/detail/bitstream.hpp>
|
||||
#include <beast/zlib/detail/ranges.hpp>
|
||||
#include <beast/zlib/detail/window.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@@ -232,7 +233,8 @@ inflate_stream::
|
||||
doReset(int windowBits)
|
||||
{
|
||||
if(windowBits < 8 || windowBits > 15)
|
||||
throw std::domain_error("windowBits out of range");
|
||||
throw beast::detail::make_exception<std::domain_error>(
|
||||
"windowBits out of range", __FILE__, __LINE__);
|
||||
w_.reset(windowBits);
|
||||
|
||||
bi_.flush();
|
||||
@@ -706,7 +708,8 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
|
||||
|
||||
case SYNC:
|
||||
default:
|
||||
throw std::logic_error("stream error");
|
||||
throw beast::detail::make_exception<std::logic_error>(
|
||||
"stream error", __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -932,8 +935,8 @@ inflate_table(
|
||||
|
||||
auto const not_enough = []
|
||||
{
|
||||
throw std::logic_error(
|
||||
"insufficient output size when inflating tables");
|
||||
throw beast::detail::make_exception<std::logic_error>(
|
||||
"insufficient output size when inflating tables", __FILE__, __LINE__);
|
||||
};
|
||||
|
||||
// check available table space
|
||||
|
||||
Reference in new issue
Block a user