-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfitsuser.cpp
More file actions
35 lines (26 loc) · 719 Bytes
/
fitsuser.cpp
File metadata and controls
35 lines (26 loc) · 719 Bytes
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
#include "fitsuser.h"
#include <fitsio.h>
#include <stdexcept>
#include <sstream>
void FitsUser::checkStatus(int status)
{
if(status != 0)
{
throwError(status);
}
}
void FitsUser::throwError(int status, const std::string &msg)
{
std::stringstream msgStr;
if(!msg.empty()) msgStr << msg << ". ";
char statusStr[FLEN_STATUS], errMsg[FLEN_ERRMSG];
fits_get_errstatus(status, statusStr);
msgStr << "CFitsio reported an error while accessing fits files. Status = " << status << ": " << statusStr;
if(fits_read_errmsg(errMsg))
{
msgStr << ". Error message stack: " << errMsg << '.';
while( fits_read_errmsg(errMsg) )
msgStr << ' ' << errMsg << '.';
}
throw std::runtime_error(msgStr.str());
}