19#include "Application.h" 
   20#include "Preference.h" 
   71                         const char *fileName, 
int lineNumber) {
 
   78    m_message = 
new QString(QString(message).trimmed());
 
 
  109                         const char *fileName, 
int lineNumber) {
 
  116    m_message = 
new QString(QString(message).trimmed());
 
 
  147                         const char *fileName, 
int lineNumber) {
 
  154    m_message = 
new QString(QString(message.c_str()).trimmed());
 
 
  196      const char *fileName, 
int lineNumber) {
 
  203    m_message = 
new QString(QString(message).trimmed());
 
 
  243      ErrorType type, 
const std::string &message,
 
  244      const char *fileName, 
int lineNumber) {
 
  251    m_message = 
new QString(QString(message.c_str()).trimmed());
 
 
  291      const char *fileName, 
int lineNumber) {
 
  298    m_message = 
new QString(message.trimmed());
 
 
  323      int length = strlen(other.m_what);
 
  324      m_what = 
new char[length + 1];
 
  325      strncpy(
m_what, other.m_what, length);
 
  329    if (other.m_message) {
 
  330      m_message = 
new QString(*other.m_message);
 
  333    if (other.m_fileName) {
 
  337    if (other.m_previousExceptions) {
 
 
  412    if (exceptionSource.m_previousExceptions) {
 
 
  445    if (errorString != 
"")
 
  446      cerr << errorString.toLatin1().data() << endl;
 
 
  460    QString errorString = 
toString(printFileInfo);
 
  461    if (errorString != 
"")
 
  462      cerr << errorString.toLatin1().data() << endl;
 
 
  476    QList<IException> exceptionsToConvert;
 
  481    exceptionsToConvert.append(*
this);
 
  483    for (
int exceptionIndex = exceptionsToConvert.size() - 1;
 
  486      const IException &exception(exceptionsToConvert.at(exceptionIndex));
 
  488      bool exceptionIsBlank = 
true;
 
  493      if (exception.m_errorType != 
Unknown) {
 
  496        exceptionIsBlank = 
false;
 
  501      if (exception.m_message) {
 
  502        exceptionIsBlank = 
false;
 
  503        QString message(*exception.m_message);
 
  505        if (message.size() && message[message.size() - 1] == 
'.')
 
  506          message = message.mid(0, message.size() - 1);
 
  510      if (exception.m_fileName) {
 
  511        exceptionIsBlank = 
false;
 
  512        errGroup += 
PvlKeyword(
"File", *exception.m_fileName);
 
  514        if (exception.m_lineNumber != -1)
 
  518      if (!exceptionIsBlank)
 
 
  536    bool reportFileLine = 
true;
 
  538    if (Preference::Preferences().hasGroup(
"ErrorFacility")) {
 
  540          Preference::Preferences().findGroup(
"ErrorFacility");
 
  541      if (errorFacility.hasKeyword(
"FileLine")) {
 
  542        QString fileLine = errorFacility[
"FileLine"][0];
 
  543        reportFileLine = (fileLine.toUpper() == 
"ON");
 
 
  565    bool usePvlFormat = 
false;
 
  567    if (Preference::Preferences().hasGroup(
"ErrorFacility")) {
 
  569          Preference::Preferences().findGroup(
"ErrorFacility");
 
  570      if (errorFacility.hasKeyword(
"Format")) {
 
  571        QString format = errorFacility[
"Format"][0];
 
  572        usePvlFormat = (format.toUpper() == 
"PVL");
 
  579      if (errors.
groups() != 0) {
 
  580        stringstream stringStream;
 
  581        stringStream << errors;
 
  582        result = stringStream.str().c_str();
 
  586      QList<IException> exceptionsToConvert;
 
  591      exceptionsToConvert.append(*
this);
 
  593      for (
int exceptionIndex = exceptionsToConvert.size() - 1;
 
  596        const IException &exception(exceptionsToConvert.at(exceptionIndex));
 
  599        if (exception.m_errorType != 
Unknown || exception.m_message) {
 
  603        bool needsPeriod = 
false;
 
  604        if (exception.m_message) {
 
  605          QString message(*exception.m_message);
 
  607          if (message.size() && message[message.size() - 1] == 
'.')
 
  608            message = message.mid(0, message.size() - 1);
 
  611          result += 
" " + message;
 
  615        if(includeFileInfo && exception.m_fileName) {
 
  616          result += 
" in " + *exception.m_fileName;
 
  617          if (exception.m_lineNumber != -1)
 
  625        if (result.size() && result[result.size() - 1] != 
'\n')
 
  630    return result.trimmed();
 
 
  641    std::swap(
m_what, other.m_what);
 
 
  677        result = 
"USER ERROR";
 
  680        result = 
"PROGRAMMER ERROR";
 
  683        result = 
"I/O ERROR";
 
 
  702      const QString &
string) {
 
  705    if(
string == 
"USER ERROR")
 
  707    else if(
string == 
"PROGRAMMER ERROR")
 
  709    else if(
string == 
"I/O ERROR")
 
 
  727    char *result = 
new char[whatStr.size() + 1];
 
  728    strncpy(result, whatStr.toLatin1().data(), whatStr.size());
 
  729    result[whatStr.size()] = 
'\0';
 
 
static QString Name()
Returns the name of the application.
 
ErrorType
Contains a set of exception error types.
 
@ Unknown
A type of error that cannot be classified as any of the other error types.
 
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
@ Io
A type of error that occurred when performing an actual I/O operation.
 
QString * m_message
The message associated with this exception.
 
IException()
The default constructor creates an IException instance with no message, previous exceptions,...
 
int m_lineNumber
The line in the source code file that threw this exception.
 
IException & operator=(const IException &rhs)
Assign the values of rhs to this instance.
 
static QString errorTypeToString(ErrorType t)
Returns the source of the error in string format for the given ErrorType.
 
const char * what() const
Returns a string representation of this exception in its current state.
 
char * m_what
This is used to store the return value of what() in a way that guarantees the returned data will not ...
 
ErrorType errorType() const
Returns the source of the error for this exception.
 
QString toString() const
Returns a string representation of this exception.
 
QList< IException > * m_previousExceptions
A list of exceptions that caused this exception.
 
ErrorType m_errorType
This exception's error source.
 
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
 
void print() const
Prints a string representation of this exception to stderr.
 
Pvl toPvl() const
Returns a PVL object representing the contents of this exception.
 
void swap(IException &other)
Swaps the values of this instance's member data with other.
 
char * buildWhat() const
Returns a C string containing a string representation of this exception.
 
~IException()
The destructor frees memory allocated for the message, filename, and list of previous exceptions.
 
void deleteEmptyMemberStrings()
This is a helper method for the constructors.
 
static ErrorType stringToErrorType(const QString &s)
Given a string, returns the error type associated with it.
 
QString * m_fileName
The source code file that threw this exception.
 
Contains multiple PvlContainers.
 
Container for cube-like labels.
 
void append(const QString &file)
Appends PVL information to a file and handles the end of line sequence.
 
A single keyword-value pair.
 
int groups() const
Returns the number of groups contained.
 
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
Namespace for the standard library.