-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFitsError.cxx
77 lines (60 loc) · 1.61 KB
/
FitsError.cxx
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
// Astrophysics Science Division,
// NASA/ Goddard Space Flight Center
// HEASARC
// http://heasarc.gsfc.nasa.gov
// e-mail: [email protected]
//
// Original author: Ben Dorman
#ifdef _MSC_VER
#include "MSconfig.h" // for truncation warning
#include <cassert>
#endif
// FITS
#include "FITS.h"
// FitsError
#include "FitsError.h"
namespace CCfits {
// Class CCfits::FitsError
FitsError::FitsError (int errornum, bool silent)
: FitsException("FITS Error: ", silent)
{
printMsg(errornum);
if (FITS::verboseMode() || !silent)
std::cerr << message() << "\n";
}
void FitsError::printMsg (int error)
{
char cMessage[FLEN_ERRMSG];
fits_get_errstatus(error, cMessage);
addToMessage(string(cMessage));
}
// Class CCfits::FitsException
FitsException::FitsException (const string& msg, bool& silent)
: m_message(msg)
{
if (FITS::verboseMode() || !silent)
{
std::cerr << '\n' << msg;
// set this to false for the purpose of this exception.
// does NOT change verbose mode setting so this value is thrown
// away after the exception completes.
silent = false;
}
}
void FitsException::addToMessage (const string& msgQual)
{
m_message += msgQual;
}
// Class CCfits::FitsFatal
FitsFatal::FitsFatal (const string& diag)
{
std::cerr << "*** CCfits Fatal Error: " << diag
<< " please report this to [email protected]\n";
#ifdef TERMINATE_DEFECT
// terminate() is not there as documented
assert ( false );
#else
std::terminate();
#endif
}
} // namespace CCfits