mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Make Error classes header only
This commit is contained in:
committed by
Dennis Klein
parent
4af0954ae9
commit
f2dce91098
@@ -38,14 +38,34 @@ enum class ErrorCode
|
||||
DeviceSetPropertiesFailed
|
||||
};
|
||||
|
||||
std::error_code MakeErrorCode(ErrorCode);
|
||||
|
||||
struct ErrorCategory : std::error_category
|
||||
{
|
||||
const char* name() const noexcept override;
|
||||
std::string message(int ev) const override;
|
||||
const char* name() const noexcept override { return "fairmq"; }
|
||||
std::string message(int ev) const override
|
||||
{
|
||||
switch (static_cast<ErrorCode>(ev)) {
|
||||
case ErrorCode::OperationInProgress:
|
||||
return "async operation already in progress";
|
||||
case ErrorCode::OperationTimeout:
|
||||
return "async operation timed out";
|
||||
case ErrorCode::OperationCanceled:
|
||||
return "async operation canceled";
|
||||
case ErrorCode::DeviceChangeStateFailed:
|
||||
return "failed to change state of a fairmq device";
|
||||
case ErrorCode::DeviceGetPropertiesFailed:
|
||||
return "failed to get fairmq device properties";
|
||||
case ErrorCode::DeviceSetPropertiesFailed:
|
||||
return "failed to set fairmq device properties";
|
||||
default:
|
||||
return "(unrecognized error)";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ErrorCategory ec;
|
||||
|
||||
inline std::error_code MakeErrorCode(ErrorCode e) { return {static_cast<int>(e), ec}; }
|
||||
|
||||
} // namespace fair::mq
|
||||
|
||||
namespace std {
|
||||
|
Reference in New Issue
Block a user