2016-10-22 04:14:19 +02:00
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
|
|
|
|
// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
|
|
|
|
// width of 100 characters per line.
|
|
|
|
//
|
|
|
|
// Author(s):
|
|
|
|
// Ivan Shapovalov <intelfx@intelfx.name>
|
|
|
|
//
|
|
|
|
// This file implements the exception hierarchy for CLBlast. It contains classes for exceptions
|
|
|
|
// generated by different parts of CLBlast (e.g. OpenCL API calls, internal logic, semantic BLAS
|
|
|
|
// errors).
|
|
|
|
//
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
#ifndef CLBLAST_EXCEPTIONS_H_
|
|
|
|
#define CLBLAST_EXCEPTIONS_H_
|
|
|
|
|
2017-10-09 19:41:40 +02:00
|
|
|
#include "utilities/utilities.hpp"
|
2016-10-22 04:14:19 +02:00
|
|
|
|
|
|
|
namespace clblast {
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
// Represents a semantic error in BLAS function arguments
|
2016-10-23 16:09:59 +02:00
|
|
|
class BLASError : public ErrorCode<Error<std::invalid_argument>, StatusCode> {
|
2016-10-22 04:14:19 +02:00
|
|
|
public:
|
|
|
|
explicit BLASError(StatusCode status, const std::string &subreason = std::string{});
|
|
|
|
};
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
// Represents a runtime error generated by internal logic
|
2016-10-23 16:09:59 +02:00
|
|
|
class RuntimeErrorCode : public ErrorCode<RuntimeError, StatusCode> {
|
2016-10-22 04:14:19 +02:00
|
|
|
public:
|
|
|
|
explicit RuntimeErrorCode(StatusCode status, const std::string &subreason = std::string{});
|
|
|
|
};
|
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
// Handles (most of the) runtime exceptions and converts them to StatusCode
|
2017-11-13 21:11:31 +01:00
|
|
|
StatusCode DispatchException(const bool silent = false);
|
2017-11-15 22:44:44 +01:00
|
|
|
StatusCode DispatchExceptionCatchAll(const bool silent = false);
|
2016-10-22 04:14:19 +02:00
|
|
|
|
|
|
|
// Handles remaining exceptions and converts them to StatusCode::kUnhandledError
|
|
|
|
StatusCode DispatchExceptionForC();
|
|
|
|
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
} // namespace clblast
|
|
|
|
|
|
|
|
#endif // CLBLAST_EXCEPTIONS_H_
|