Frobby 0.9.5
error.cpp
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see http://www.gnu.org/licenses/.
16*/
17#include "stdinc.h"
18#include "error.h"
19
20#include "Scanner.h"
21#include "FrobbyStringStream.h"
22
23void reportError(const string& errorMsg) {
25 err << "ERROR: " << errorMsg;
26 throw FrobbyException(err);
27}
28
29void reportInternalError(const string& errorMsg) {
31 err << "INTERNAL ERROR: " << errorMsg << '\n';
33}
34
36(const string& errorMsg, const char* file, unsigned int lineNumber) {
38 err << errorMsg << '\n'
39 << "The internal error occurred in file " << file
40 << " on line " << lineNumber << '.';
42}
43
44void reportSyntaxError(const Scanner& scanner, const string& errorMsg) {
46 err << "SYNTAX ERROR (";
47
48 if (scanner.getFormat() != "")
49 err << "format " << scanner.getFormat() << ", ";
50
51 err << "line "
52 << scanner.getLineNumber()
53 << "):\n "
54 << errorMsg
55 << '\n';
56
57 throw FrobbyException(err);
58}
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
This is the base of the Frobby exception hierarchy for exceptions that can occur due to expected erro...
Definition error.h:27
A replacement for stringstream.
This exception signals that a bug in Frobby has been detected.
Definition error.h:33
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition Scanner.h:50
void reportInternalError(const string &errorMsg)
Definition error.cpp:29
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
Definition error.cpp:44
void reportError(const string &errorMsg)
Definition error.cpp:23