Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a diagnostic hint to input stream error #318

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/boost/archive/basic_text_iprimitive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <locale>
#include <cstddef> // size_t
#include <cstdlib> // itoa

#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
Expand Down Expand Up @@ -86,10 +87,13 @@ class BOOST_SYMBOL_VISIBLE basic_text_iprimitive {
template<class T>
void load(T & t)
{
auto pos = is.tellg();
if(is >> t)
return;
static char at_offset[64] = "at offset ";
itoa(pos, &at_offset[10], 10);
boost::serialization::throw_exception(
archive_exception(archive_exception::input_stream_error)
archive_exception(archive_exception::input_stream_error, at_offset)
);
}

Expand Down