error_handling.cc 1.19 KB
Newer Older
Martin Reinecke's avatar
Martin Reinecke committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 *  This file is part of the MR utility library.
 *
 *  This code is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This code is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this code; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/* Copyright (C) 2019 Max-Planck-Society
   Author: Martin Reinecke */

Martin Reinecke's avatar
Martin Reinecke committed
22
#include "mr_util/error_handling.h"
Martin Reinecke's avatar
Martin Reinecke committed
23
24
25

using namespace std;

Martin Reinecke's avatar
Martin Reinecke committed
26
27
namespace mr {

Martin Reinecke's avatar
Martin Reinecke committed
28
namespace detail_error_handling {
Martin Reinecke's avatar
Martin Reinecke committed
29

Martin Reinecke's avatar
Martin Reinecke committed
30
31
32
33
bool abort_in_progress__ = false;

ostream &CodeLocation::print(ostream &os) const
  {
Martin Reinecke's avatar
Martin Reinecke committed
34
35
36
  os << file <<  ": " <<  line;
  if (func) os << " (" << func << ")";
  os << ":\n";
Martin Reinecke's avatar
Martin Reinecke committed
37
38
39
40
41
42
43
44
  return os;
  }

void killjob__()
  {
  // perhaps print stack trace?
  exit(1);
  }
Martin Reinecke's avatar
Martin Reinecke committed
45

Martin Reinecke's avatar
Martin Reinecke committed
46
}}