ArrayFire: exception.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10#pragma once
11
12#ifdef __cplusplus
13
14#include
16
17namespace af {
18
22{
23private:
24 char m_msg[1024];
26public:
31
35
38 exception(const char *msg, const char *file, unsigned line, af_err err);
39#if AF_API_VERSION >= 33
42 exception(const char *msg, const char *func, const char *file, unsigned line, af_err err);
43#endif
46 virtual const char *what() const throw() { return m_msg; }
47
50 { return s << e.what(); }
51};
52
53}
54
55#endif
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
66
71
72#ifdef __cplusplus
73}
74#endif
An ArrayFire exception class.
exception(const char *msg, const char *file, unsigned line, af_err err)
Creates a new af::exception with a formatted error message for a given an error code,...
exception(const char *msg, const char *func, const char *file, unsigned line, af_err err)
Creates a new exception given a message, function name, file name, line number and error code.
virtual const char * what() const
Returns an error message for the exception in a string format.
exception(const char *msg)
Creates a new af::exception given a message. The error code is AF_ERR_UNKNOWN.
exception(const char *file, unsigned line, af_err err)
Creates a new exception with a formatted error message for a given file and line number in the source...
friend std::ostream & operator<<(std::ostream &s, const exception &e)
Writes the exception to a stream.
AFAPI void af_get_last_error(char **msg, dim_t *len)
Returns the last error message that occurred and its error message.
AFAPI const char * af_err_to_string(const af_err err)
Converts the af_err error code to its string representation.