Add file and line number to thrown exceptions

This commit is contained in:
Vinnie Falco
2017-07-20 08:12:14 -07:00
parent e66327ed4d
commit cfde28c3c3
12 changed files with 80 additions and 34 deletions
+2 -2
View File
@@ -524,8 +524,8 @@ basic_streambuf<Allocator>::basic_streambuf(
, alloc_size_(alloc_size)
{
if(alloc_size <= 0)
throw std::invalid_argument(
"basic_streambuf: invalid alloc_size");
throw detail::make_exception<std::invalid_argument>(
"invalid alloc_size", __FILE__, __LINE__);
}
template<class Allocator>
+3 -2
View File
@@ -8,6 +8,7 @@
#ifndef BEAST_IMPL_BUFFERS_ADAPTER_IPP
#define BEAST_IMPL_BUFFERS_ADAPTER_IPP
#include <beast/core/detail/type_traits.hpp>
#include <boost/asio/buffer.hpp>
#include <algorithm>
#include <cstring>
@@ -413,8 +414,8 @@ buffers_adapter<MutableBufferSequence>::prepare(std::size_t n) ->
}
}
if(n > 0)
throw std::length_error(
"no space in buffers_adapter");
throw detail::make_exception<std::length_error>(
"no space", __FILE__, __LINE__);
return mutable_buffers_type{*this};
}
+3 -1
View File
@@ -8,6 +8,7 @@
#ifndef BEAST_IMPL_STATIC_STREAMBUF_IPP
#define BEAST_IMPL_STATIC_STREAMBUF_IPP
#include <beast/core/detail/type_traits.hpp>
#include <boost/asio/buffer.hpp>
#include <algorithm>
#include <cstring>
@@ -295,7 +296,8 @@ static_streambuf::prepare(std::size_t n) ->
mutable_buffers_type
{
if(n > static_cast<std::size_t>(end_ - out_))
throw std::length_error("no space in streambuf");
throw detail::make_exception<std::length_error>(
"no space in streambuf", __FILE__, __LINE__);
last_ = out_ + n;
return mutable_buffers_type{out_, n};
}