Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
2bda4ac9
Commit
2bda4ac9
authored
7 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[exceptions] add handling of tbb/boost/std exceptions
Not sure about the boost case, however...
parent
9381d0aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/xt/common/bindings.cc
+3
-3
3 additions, 3 deletions
dune/xt/common/bindings.cc
dune/xt/common/exceptions.bindings.hh
+68
-0
68 additions, 0 deletions
dune/xt/common/exceptions.bindings.hh
with
71 additions
and
3 deletions
dune/xt/common/bindings.cc
+
3
−
3
View file @
2bda4ac9
...
...
@@ -16,7 +16,7 @@
#include
<boost/numeric/conversion/cast.hpp>
#include
<dune/xt/common/exceptions.hh>
#include
<dune/xt/common/exceptions.
bindings.
hh>
#include
<dune/common/parallel/mpihelper.hh>
...
...
@@ -30,7 +30,7 @@
#include
<dune/xt/common/string.hh>
#include
<dune/xt/common/timedlogging.hh>
#include
"exceptions.
p
bh"
#include
"exceptions.b
indings.h
h"
#include
"fvector.pbh"
#include
"fmatrix.pbh"
#include
"configuration.pbh"
...
...
@@ -43,7 +43,7 @@ PYBIND11_PLUGIN(_common)
py
::
module
m
(
"_common"
,
"dune-xt-common"
);
Dune
::
XT
::
Common
::
bind
_E
xception
(
m
);
Dune
::
XT
::
Common
::
bind
ings
::
addbind_e
xception
s
(
m
);
m
.
def
(
"_init_mpi"
,
[](
const
std
::
vector
<
std
::
string
>&
args
)
{
...
...
This diff is collapsed.
Click to expand it.
dune/xt/common/exceptions.
p
bh
→
dune/xt/common/exceptions.b
indings.h
h
+
68
−
0
View file @
2bda4ac9
...
...
@@ -7,12 +7,18 @@
// Authors:
// Felix Schindler (2016 - 2017)
#ifndef DUNE_XT_COMMON_EXCEPTIONS_
P
BH
#define DUNE_XT_COMMON_EXCEPTIONS_
P
BH
#ifndef DUNE_XT_COMMON_EXCEPTIONS_B
INDINGS_H
H
#define DUNE_XT_COMMON_EXCEPTIONS_B
INDINGS_H
H
#if HAVE_DUNE_PYBINDXI
#include
<string>
#include
<boost/exception/all.hpp>
#if HAVE_TBB
#include
<tbb/tbb_exception.h>
#endif
#include
<dune/pybindxi/pybind11.h>
#include
"exceptions.hh"
...
...
@@ -20,29 +26,43 @@
namespace
Dune
{
namespace
XT
{
namespace
Common
{
namespace
bindings
{
void bind_
E
xception(pybind11::module& m)
void
add
bind_
e
xception
s
(
pybind11
::
module
&
m
)
{
namespace
py
=
pybind11
;
static py::exception<Exception> exc(m, "DuneError");
static
py
::
exception
<
std
::
exception
>
std_exc
(
m
,
"StdError"
);
#if HAVE_TBB
static
py
::
exception
<
tbb
::
tbb_exception
>
tbb_exc
(
m
,
"TbbError"
);
#endif
static
py
::
exception
<
boost
::
exception
>
boost_exc
(
m
,
"BoostError"
);
static
py
::
exception
<
Dune
::
Exception
>
dune_exc
(
m
,
"DuneError"
);
py
::
register_exception_translator
([](
std
::
exception_ptr
p
)
{
try
{
if
(
p
)
std
::
rethrow_exception
(
p
);
} catch (const Exception& e) {
exc(std::string(e.what()).c_str());
}
catch
(
const
boost
::
exception
&
e
)
{
boost_exc
(
boost
::
diagnostic_information_what
(
e
));
}
catch
(
const
Dune
::
Exception
&
e
)
{
dune_exc
(
e
.
what
());
#if HAVE_TBB
}
catch
(
const
tbb
::
tbb_exception
&
e
)
{
tbb_exc
(
std
::
string
(
e
.
name
()
+
": "
+
e
.
what
()).
c_str
());
#endif
}
catch
(
const
std
::
exception
&
e
)
{
std_exc
(
e
.
what
());
}
});
} // ... bind_Exception(...)
}
// ... addbind_exceptions(...)
}
// namespace bindings
}
// namespace Common
}
// namespace XT
}
// namespace Dune
#endif // HAVE_DUNE_PYBINDXI
#endif // DUNE_XT_COMMON_EXCEPTIONS_
P
BH
#endif // DUNE_XT_COMMON_EXCEPTIONS_B
INDINGS_H
H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment