exception.h
Go to the documentation of this file.
/*******************************************************
* Copyright (c) 2015-2019, 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
********************************************************/
#pragma once
#include <fg/defines.h>
#ifdef __cplusplus
#include <iostream>
#include <stdexcept>
namespace forge
{
class FGAPI Error : public std::exception
{
private:
char mMessage[1024];
ErrorCode mErrCode;
public:
ErrorCode err() const { return mErrCode; }
Error();
Error(const char * const pMessage);
Error(const char * const pFileName, int pLine, ErrorCode pErrCode);
Error(const char * const pMessage, const char * const pFileName, int pLine, ErrorCode pErrCode);
Error(const char * const pMessage, const char * const pFuncName,
const char * const pFileName, int pLine, ErrorCode pErrCode);
virtual ~Error() throw();
virtual const char * what() const throw() { return mMessage; }
friend inline std::ostream& operator<<(std::ostream &s, const Error &e)
{ return s << e.what(); }
};
} // namespace forge
#endif
#ifdef __cplusplus
extern "C" {
#endif
FGAPI void fg_get_last_error(char **msg, int *len);
FGAPI const char * fg_err_to_string(const fg_err err);
#ifdef __cplusplus
}
#endif
forge::Error::Error
Error(const char *const pMessage)
forge::Error::Error
Error()
forge::Error::operator<<
friend std::ostream & operator<<(std::ostream &s, const Error &e)
Definition exception.h:48
forge::Error::Error
Error(const char *const pMessage, const char *const pFuncName, const char *const pFileName, int pLine, ErrorCode pErrCode)
forge::Error::err
ErrorCode err() const
Definition exception.h:31
forge::Error::~Error
virtual ~Error()
forge::Error::Error
Error(const char *const pMessage, const char *const pFileName, int pLine, ErrorCode pErrCode)
forge::Error::what
virtual const char * what() const
Definition exception.h:46
forge::Error::Error
Error(const char *const pFileName, int pLine, ErrorCode pErrCode)
defines.h
FGAPI
#define FGAPI
Definition defines.h:28
fg_err
fg_err
Definition defines.h:49
fg_err_to_string
FGAPI const char * fg_err_to_string(const fg_err err)
fg_get_last_error
FGAPI void fg_get_last_error(char **msg, int *len)
forge
Definition chart.h:305
forge::ErrorCode
fg_err ErrorCode
Definition defines.h:180