Skip to content

Commit

Permalink
Merge pull request #249 from bitshares/update-asio-error
Browse files Browse the repository at this point in the history
Rethrow asio operation cancellation exception as `fc::canceled_exception`
  • Loading branch information
abitmore authored Sep 5, 2023
2 parents 2405393 + c38d044 commit 33cd59c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@ namespace fc {
{
if( ec == boost::asio::error::eof )
{
p->set_exception( fc::exception_ptr( new fc::eof_exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
p->set_exception( std::make_shared<fc::eof_exception>(
FC_LOG_MESSAGE( error, "${message} ",
("message", boost::system::system_error(ec).what())) ) );
}
else if( ec == boost::asio::error::operation_aborted )
{
p->set_exception( std::make_shared<fc::canceled_exception>(
FC_LOG_MESSAGE( error, "${message} ",
("message", boost::system::system_error(ec).what())) ) );
}
else
{
p->set_exception( fc::exception_ptr( new fc::exception(
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
p->set_exception( std::make_shared<fc::exception>(
FC_LOG_MESSAGE( error, "${message} ",
("message", boost::system::system_error(ec).what())) ) );
}
}
}
Expand Down

0 comments on commit 33cd59c

Please sign in to comment.