diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-10-22 15:36:48 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2016-10-22 15:36:48 +0200 |
commit | b0ff11acf0c857874e518717164eff3ddbabb803 (patch) | |
tree | 8d3754380ff5c54a8c929f542949228bf39ae645 /src/utilities/clblast_exceptions.hpp | |
parent | 9afbbc9ef92e2d3427f8de0327daa8f4a134adc0 (diff) |
Moved files around a bit; created a utilities subfolder
Diffstat (limited to 'src/utilities/clblast_exceptions.hpp')
-rw-r--r-- | src/utilities/clblast_exceptions.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/utilities/clblast_exceptions.hpp b/src/utilities/clblast_exceptions.hpp new file mode 100644 index 00000000..89f5e761 --- /dev/null +++ b/src/utilities/clblast_exceptions.hpp @@ -0,0 +1,50 @@ + +// ================================================================================================= +// 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_ + +#include "clblast.h" +#include "clpp11.hpp" + +namespace clblast { +// ================================================================================================= + +// Represents a semantic error in BLAS function arguments +class PUBLIC_API BLASError : public ErrorCode<Error<std::invalid_argument>, StatusCode> { + public: + explicit BLASError(StatusCode status, const std::string &subreason = std::string{}); +}; +// ================================================================================================= + +// Represents a runtime error generated by internal logic +class PUBLIC_API RuntimeErrorCode : public ErrorCode<RuntimeError, StatusCode> { + public: + explicit RuntimeErrorCode(StatusCode status, const std::string &subreason = std::string{}); +}; + +// ================================================================================================= + +// Handles (most of the) runtime exceptions and converts them to StatusCode +StatusCode DispatchException(); + +// Handles remaining exceptions and converts them to StatusCode::kUnhandledError +StatusCode DispatchExceptionForC(); + +// ================================================================================================= + +} // namespace clblast + +#endif // CLBLAST_EXCEPTIONS_H_ |