MeDiPack  1.3.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1/*
2 * MeDiPack, a Message Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of MeDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * MeDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation, either
15 * version 3 of the License, or (at your option) any later version.
16 *
17 * MeDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU
23 * Lesser General Public License along with MeDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Authors: Max Sagebaum, Tim Albring (SciComp, University of Kaiserslautern-Landau)
27 */
28
29#pragma once
30
31#include <cstdio>
32#include <cstdarg>
33
34
38namespace medi {
44 #define MEDI_EXCEPTION(...) medi::outputException( __func__, __FILE__, __LINE__, __VA_ARGS__)
45
57 inline void outputException(const char function[], const char file[], const int line, const char* message, ...) {
58 fprintf(stderr, "Error in function %s (%s:%d)\nThe message is: ", function, file, line);
59
60 va_list vl;
61 va_start(vl, message);
62 vfprintf(stderr, message, vl);
63 va_end(vl);
64
65 fprintf(stderr, "\n");
66 exit(-1);
67 }
68}
69
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
void outputException(const char function[], const char file[], const int line, const char *message,...)
Prints the positions and the message of the exception.
Definition exceptions.hpp:57