Generic error handling example.
#include "msparser.hpp"
#include <iostream>
using namespace matrix_science;
static void checkErrorHandler(
ms_errors *obj);
int main(int argc, char * argv[])
{
if (argc == 2)
{
}
else
{
}
{
checkErrorHandler(&file);
}
else
{
std::cout << "The file has been read and parsed successfully. Congratulations!"
<< std::endl;
}
return 0;
}
static void checkErrorHandler(
ms_errors *obj)
{
std::cout << "Last error description " << std::endl;
std::cout << "=========================================" << std::endl;
std::cout << "=========================================" << std::endl;
std::cout << "Testing the error handling... " << std::endl;
std::cout << "=========================================" << std::endl;
{
std::cout << "Error number: "
<< " ("
<< " times) : "
<< std::endl;
}
std::cout << std::endl;
}
Encapsulates the mascot.dat file that contains the most important parameters.
Definition: ms_datfile.hpp:47
void read_file()
Call this method in order to read the configuration information from the file.
Definition: ms_datfile.cpp:1857
void setFileName(const char *name)
Set the file name explicitly, before saving or loading.
Definition: ms_datfile.cpp:1670
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
std::string getLastErrorString() const
Return the error description of the last error that occurred.
Definition: ms_errors.cpp:1488
const ms_errs * getErrorHandler() const
Retrive the error object using this function to get access to all errors and error parameters.
Definition: ms_errors.cpp:1518
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
void clearAllErrors()
Remove all errors from the current list of errors.
Definition: ms_errors.cpp:1457
All errors are collected in an instance of this class.
Definition: ms_errors.hpp:37
int getErrorRepeats(const int num=-1) const
Returns a number of times the specified error has been repeated.
Definition: ms_errors.cpp:1171
int getErrorNumber(const int num=-1) const
Return a specific error number or ERR_NO_ERROR.
Definition: ms_errors.cpp:1044
std::string getErrorString(const int num) const
Returns a specific error as a string.
Definition: ms_errors.cpp:1094
int getNumberOfErrors() const
Return the number of errors since the last call to clearAllErrors().
Definition: ms_errors.cpp:1004