diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 5122370e2..d687ce060 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -106,6 +106,10 @@

Construct Wait object in milliseconds instead of fractional seconds.

+ +

Add THROW*_ON_SYS_ERROR* macros to test and throw system errors.

+
+

Storage interface methods no longer declare the driver as const.

diff --git a/src/common/error.h b/src/common/error.h index 36946a4c8..282875a42 100644 --- a/src/common/error.h +++ b/src/common/error.h @@ -150,6 +150,34 @@ Throw an error when a system call fails #define THROWP_SYS_ERROR_FMT(errorType, ...) \ errorInternalThrowSysFmt(errno, errorType, __FILE__, __func__, __LINE__, __VA_ARGS__) +#define THROW_ON_SYS_ERROR(error, errorType, message) \ + do \ + { \ + if (error) \ + errorInternalThrowSys(errno, &errorType, __FILE__, __func__, __LINE__, message); \ + } while(0) + +#define THROW_ON_SYS_ERROR_FMT(error, errorType, ...) \ + do \ + { \ + if (error) \ + errorInternalThrowSysFmt(errno, &errorType, __FILE__, __func__, __LINE__, __VA_ARGS__); \ + } while(0) + +#define THROWP_ON_SYS_ERROR(error, errorType, message) \ + do \ + { \ + if (error) \ + errorInternalThrowSys(errno, errorType, __FILE__, __func__, __LINE__, message); \ + } while(0) + +#define THROWP_ON_SYS_ERROR_FMT(error, errorType, ...) \ + do \ + { \ + if (error) \ + errorInternalThrowSysFmt(errno, errorType, __FILE__, __func__, __LINE__, __VA_ARGS__); \ + } while(0) + #define THROW_SYS_ERROR_CODE(errNo, errorType, message) \ errorInternalThrowSys(errNo, &errorType, __FILE__, __func__, __LINE__, message) #define THROW_SYS_ERROR_CODE_FMT(errNo, errorType, ...) \