mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899546 - ENSURE_SUCCESS macro for ErrorResult, r=bz
This commit is contained in:
parent
1903f4c376
commit
0fc4510b29
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsStringGlue.h"
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -145,6 +146,32 @@ private:
|
|||||||
ErrorResult(const ErrorResult&) MOZ_DELETE;
|
ErrorResult(const ErrorResult&) MOZ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
** Macros for checking results
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define ENSURE_SUCCESS(res, ret) \
|
||||||
|
do { \
|
||||||
|
if (res.Failed()) { \
|
||||||
|
nsCString msg; \
|
||||||
|
msg.AppendPrintf("ENSURE_SUCCESS(%s, %s) failed with " \
|
||||||
|
"result 0x%X", #res, #ret, res.ErrorCode()); \
|
||||||
|
NS_WARNING(msg.get()); \
|
||||||
|
return ret; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define ENSURE_SUCCESS_VOID(res) \
|
||||||
|
do { \
|
||||||
|
if (res.Failed()) { \
|
||||||
|
nsCString msg; \
|
||||||
|
msg.AppendPrintf("ENSURE_SUCCESS_VOID(%s) failed with " \
|
||||||
|
"result 0x%X", #res, res.ErrorCode()); \
|
||||||
|
NS_WARNING(msg.get()); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif /* mozilla_ErrorResult_h */
|
#endif /* mozilla_ErrorResult_h */
|
||||||
|
Loading…
Reference in New Issue
Block a user