-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathError.cpp
More file actions
33 lines (30 loc) · 1.2 KB
/
Error.cpp
File metadata and controls
33 lines (30 loc) · 1.2 KB
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
/* Copyright 2019-2023 The openPMD Community
*
* This header is used to centrally define classes that shall not violate the
* C++ one-definition-rule (ODR) for various Python translation units.
*
* Authors: Franz Poeschel, Axel Huebl
* License: LGPL-3.0-or-later
*/
#include "openPMD/Error.hpp"
#include "openPMD/binding/python/Common.hpp"
void init_Error(py::module &m)
{
auto &baseError = py::register_exception<Error>(m, "Error");
py::register_exception<error::OperationUnsupportedInBackend>(
m, "ErrorOperationUnsupportedInBackend", baseError);
py::register_exception<error::WrongAPIUsage>(
m, "ErrorWrongAPIUsage", baseError);
py::register_exception<error::BackendConfigSchema>(
m, "ErrorBackendConfigSchema", baseError);
py::register_exception<error::Internal>(m, "ErrorInternal", baseError);
py::register_exception<error::NoSuchAttribute>(
m, "ErrorNoSuchAttribute", baseError);
py::register_exception<error::IllegalInOpenPMDStandard>(
m, "ErrorIllegalInOpenPMDStandard", baseError);
#ifndef NDEBUG
m.def("test_throw", [](std::string description) {
throw error::OperationUnsupportedInBackend("json", description);
});
#endif
}