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
286f680e
Commit
286f680e
authored
6 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[exceptions] only use coloring output if terminal supports it, fixes #5
parent
055e7c6f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/common/exceptions.hh
+9
-3
9 additions, 3 deletions
dune/xt/common/exceptions.hh
with
9 additions
and
3 deletions
dune/xt/common/exceptions.hh
+
9
−
3
View file @
286f680e
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
<dune/common/exceptions.hh>
#include
<dune/common/exceptions.hh>
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/xt/common/color.hh>
#include
<dune/xt/common/deprecated.hh>
#include
<dune/xt/common/deprecated.hh>
#ifdef DUNE_THROW
#ifdef DUNE_THROW
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
#if HAVE_TBB
#if HAVE_TBB
namespace
tbb
{
namespace
tbb
{
class
tbb_exception
;
class
tbb_exception
;
}
}
...
@@ -49,9 +51,9 @@ if (a.size() != b.size())
...
@@ -49,9 +51,9 @@ if (a.size() != b.size())
*/
*/
#define DUNE_THROW(E, m) \
#define DUNE_THROW(E, m) \
do { \
do { \
const std::string th__red =
"\033[31m";
\
const std::string th__red =
Dune::XT::Common::terminal_supports_color() ? "\033[31m" : "";
\
const std::string th__brown =
"\033[33m";
\
const std::string th__brown =
Dune::XT::Common::terminal_supports_color() ? "\033[33m" : "";
\
const std::string th__clear =
"\033[0m";
\
const std::string th__clear =
Dune::XT::Common::terminal_supports_color() ? "\033[0m" : "";
\
E th__ex; \
E th__ex; \
std::ostringstream th__msg; \
std::ostringstream th__msg; \
th__msg << m; \
th__msg << m; \
...
@@ -72,6 +74,7 @@ if (a.size() != b.size())
...
@@ -72,6 +74,7 @@ if (a.size() != b.size())
} while (0)
} while (0)
// DUNE_THROW
// DUNE_THROW
#define DUNE_THROW_IF(condition, E, m) \
#define DUNE_THROW_IF(condition, E, m) \
do { \
do { \
if (condition) { \
if (condition) { \
...
@@ -79,6 +82,7 @@ if (a.size() != b.size())
...
@@ -79,6 +82,7 @@ if (a.size() != b.size())
} \
} \
} while (0)
} while (0)
namespace
Dune
{
namespace
Dune
{
namespace
XT
{
namespace
XT
{
namespace
Common
{
namespace
Common
{
...
@@ -146,7 +150,9 @@ class dependency_missing : public Dune::Exception
...
@@ -146,7 +150,9 @@ class dependency_missing : public Dune::Exception
int
handle_exception
(
const
Dune
::
Exception
&
exp
);
int
handle_exception
(
const
Dune
::
Exception
&
exp
);
int
handle_exception
(
const
std
::
exception
&
exp
);
int
handle_exception
(
const
std
::
exception
&
exp
);
#if HAVE_TBB
#if HAVE_TBB
int
handle_exception
(
const
tbb
::
tbb_exception
&
exp
);
int
handle_exception
(
const
tbb
::
tbb_exception
&
exp
);
#endif
#endif
...
...
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