errors.hh 748 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once

#include <dune/common/exceptions.hh>

/**
 * \file
 * \brief Macro for wrapping error checks and throwing exceptions
 */

namespace Dune {

class VtkError : public Exception {};

}

/**
Praetorius, Simon's avatar
Praetorius, Simon committed
17
 * \brief check if condition \a cond holds; otherwise, throw a VtkError with a message.
18
 */
Praetorius, Simon's avatar
Praetorius, Simon committed
19
#define VTK_ASSERT_MSG(cond, text)      \
20
21
22
23
  do {                                  \
    if (!(cond))                        \
      DUNE_THROW(Dune::VtkError, text); \
  } while (false)
Praetorius, Simon's avatar
Praetorius, Simon committed
24
25
26
27
28
29
30
31
32
33


/**
 * \brief check if condition \a cond holds; otherwise, throw a VtkError.
 */
#define VTK_ASSERT(cond)                \
  do {                                  \
    if (!(cond))                        \
      DUNE_THROW(Dune::VtkError, #cond); \
  } while (false)