STIR 6.4.0
error.h
Go to the documentation of this file.
1//
2//
3#ifndef __stir_error_H__
4#define __stir_error_H__
5/*
6 Copyright (C) 2000 PARAPET partners
7 Copyright (C) 2000 - 2010-06-25, Hammersmith Imanet Ltd
8 Copyright (C) 2013-01-01 - 2013, Kris Thielemans
9 This file is part of STIR.
10 SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
11
12 See STIR/LICENSE.txt for details
13*/
22#include "stir/common.h"
23#include <iostream>
24#include <sstream>
25
26#include "TextWriter.h"
27
28START_NAMESPACE_STIR
29
31
49void error(const char* const s, ...);
50
52
71
72template <class STRING>
73inline void
74error(const STRING& string)
75{
76 std::stringstream sstr;
77 sstr << "\nERROR: " << string << std::endl;
78 writeText(sstr.str().c_str(), ERROR_CHANNEL);
79 throw std::runtime_error(sstr.str());
80}
81
82END_NAMESPACE_STIR
83#endif
basic configuration include file
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition error.cxx:42