1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* This file is part of the source code of the software program
* Vampire. It is protected by applicable
* copyright laws.
*
* This source code is distributed under the licence found here
* https://vprover.github.io/license.html
* and in the source directory
*/
/**
* Class Exception.cpp. Implements Vampire exceptions.
*
* @since 03/12/2003, Manchester
*/
#include <cstring>
#include "Int.hpp"
#include "Exception.hpp"
namespace Lib
{
using namespace std;
Exception::Exception (const char* msg, int line)
: _message((std::string(msg)+": "+Int::toString(line)).c_str()) {}
/**
* Write a description of the exception to a stream.
*/
void Exception::cry (std::ostream& str) const
{
str << _message << endl;
} // Exception::cry
/**
* Write a description of the exception to a stream.
*/
void UserErrorException::cry (std::ostream& str) const
{
str << "User error: " << _message;
if(line) {
str << " (detected at or around line " << line;
if (!filename.empty()) {
str << " in file " << filename;
}
str << ")";
}
str << endl;
} // UserErrorException::cry
/**
* Write a description of the exception to a stream.
*/
void InvalidOperationException::cry (std::ostream& str) const
{
str << "Invalid operation: " << _message << endl;
} // InvalidOperationException::cry
SystemFailException::SystemFailException(const std::string msg, int err)
: Exception(msg+" error "+Int::toString(err)+": "+strerror(err)), err(err)
{
//#if VDEBUG
// LOGS("system fail exception thrown");
//#endif
}
/**
* Write a description of the exception to a stream.
*/
void SystemFailException::cry (std::ostream& str) const
{
str << "System fail: " << _message << endl;
} // SystemFailException::cry
/**
* Write a description of the exception to a stream.
*/
void NotImplementedException::cry (std::ostream& str) const
{
str << "Not implemented at " << file << ":" << line << endl;
} // NotImplementedException::cry
}