mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Add THROW*_ON_SYS_ERROR* macros to test and throw system errors.
These macros check the error result internally and are appropriate for system calls that won't return errors and so break coverage.
This commit is contained in:
parent
22ecbc153a
commit
257df96b12
@ -106,6 +106,10 @@
|
|||||||
<p>Construct <code>Wait</code> object in milliseconds instead of fractional seconds.</p>
|
<p>Construct <code>Wait</code> object in milliseconds instead of fractional seconds.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|
||||||
|
<release-item>
|
||||||
|
<p>Add <code>THROW*_ON_SYS_ERROR*</code> macros to test and throw system errors.</p>
|
||||||
|
</release-item>
|
||||||
|
|
||||||
<release-item>
|
<release-item>
|
||||||
<p><code>Storage</code> interface methods no longer declare the driver as const.</p>
|
<p><code>Storage</code> interface methods no longer declare the driver as const.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
@ -150,6 +150,34 @@ Throw an error when a system call fails
|
|||||||
#define THROWP_SYS_ERROR_FMT(errorType, ...) \
|
#define THROWP_SYS_ERROR_FMT(errorType, ...) \
|
||||||
errorInternalThrowSysFmt(errno, errorType, __FILE__, __func__, __LINE__, __VA_ARGS__)
|
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) \
|
#define THROW_SYS_ERROR_CODE(errNo, errorType, message) \
|
||||||
errorInternalThrowSys(errNo, &errorType, __FILE__, __func__, __LINE__, message)
|
errorInternalThrowSys(errNo, &errorType, __FILE__, __func__, __LINE__, message)
|
||||||
#define THROW_SYS_ERROR_CODE_FMT(errNo, errorType, ...) \
|
#define THROW_SYS_ERROR_CODE_FMT(errNo, errorType, ...) \
|
||||||
|
Loading…
Reference in New Issue
Block a user