Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions include/boost/capy/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ namespace capy {

Return `error::eof` when originating an eof error.
Check `ec == cond::eof` for portable comparison.

Return `error::canceled` when originating a cancellation error.
Check `ec == cond::canceled` for portable comparison.
*/
enum class error
{
eof = 1,
canceled,
test_failure
};

Expand Down
3 changes: 3 additions & 0 deletions src/cond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ equivalent(
return ec == capy::error::eof;

case cond::canceled:
// Check capy::error::canceled
if(ec == capy::error::canceled)
return true;
// Check boost::system::errc
if(ec == boost::system::errc::operation_canceled)
return true;
Expand Down
1 change: 1 addition & 0 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message(
switch(static_cast<error>(code))
{
case error::eof: return "eof";
case error::canceled: return "operation canceled";
case error::test_failure: return "test failure";
default:
return "unknown";
Expand Down
Loading