forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.hpp
More file actions
30 lines (27 loc) · 1.51 KB
/
error.hpp
File metadata and controls
30 lines (27 loc) · 1.51 KB
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
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <common/defines.hpp>
#include <af/device.h>
#include <af/exception.h>
#define AF_THROW(fn) \
do { \
af_err __err = fn; \
if (__err == AF_SUCCESS) break; \
char *msg = NULL; \
af_get_last_error(&msg, NULL); \
af::exception ex(msg, __PRETTY_FUNCTION__, __AF_FILENAME__, __LINE__, \
__err); \
af_free_host(msg); \
throw std::move(ex); \
} while (0)
#define AF_THROW_ERR(__msg, __err) \
do { \
throw af::exception(__msg, __PRETTY_FUNCTION__, __AF_FILENAME__, \
__LINE__, __err); \
} while (0)