forked from openPMD/openPMD-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathError.hpp
75 lines (64 loc) · 1.57 KB
/
Error.hpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include <exception>
#include <string>
#include <utility>
#include <vector>
namespace openPMD
{
/**
* @brief Base class for all openPMD-specific error types.
*
* Should not be instantiated directly, but only by implementing child classes
* in the openPMD::error namespace.
*
*/
class Error : public std::exception
{
private:
std::string m_what;
protected:
Error( std::string what ) : m_what( what )
{
}
public:
virtual const char * what() const noexcept;
Error( Error const & ) = default;
Error( Error && ) = default;
Error & operator=( Error const & ) = default;
Error & operator=( Error && ) = default;
virtual ~Error() noexcept = default;
};
namespace error
{
/**
* @brief An operation was requested that is not supported in a specific
* backend.
*
* Example: Append mode is not available in ADIOS1.
*/
class OperationUnsupportedInBackend : public Error
{
public:
std::string backend;
OperationUnsupportedInBackend(
std::string backend_in, std::string what );
};
/**
* @brief The API was used in an illegal way.
*
* Example: File-based iteration encoding is selected without specifying an
* expansion pattern.
*/
class WrongAPIUsage : public Error
{
public:
WrongAPIUsage( std::string what );
};
class BackendConfigSchema : public Error
{
public:
std::vector< std::string > errorLocation;
BackendConfigSchema( std::vector< std::string >, std::string what );
};
}
}