2024-11-10 20:20:34 +08:00
|
|
|
#include "ErrorCode.h"
|
|
|
|
#include <nng/nng.h>
|
|
|
|
|
|
|
|
namespace Nng {
|
|
|
|
const char *ErrorCategory::name() const noexcept {
|
|
|
|
return "nng";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string ErrorCategory::message(int ev) const {
|
|
|
|
return nng_strerror(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const std::error_category &errorCategory() {
|
|
|
|
static ErrorCategory instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::error_code makeErrorCode(int code) {
|
|
|
|
return {code, errorCategory()};
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Nng
|