-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy patherror.h
41 lines (37 loc) · 1.53 KB
/
error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#define COND2ERR(b) \
do \
{ \
if (b) \
{ \
LOG_DEBUG("error at %s:%d\n", __FILE__, __LINE__); \
goto err; \
} \
} while (0)
#define COND2LOGERR(b, msg) \
do \
{ \
if (b) \
{ \
LOG_ERROR("error at %s:%d: %s\n", __FILE__, __LINE__, msg); \
goto err; \
} \
} while (0)
#define CATCH(b, expr) \
do \
{ \
try \
{ \
expr; \
b = true; \
} \
catch (...) \
{ \
b = false; \
} \
} while (0);