![]() |
FMT 1.2.0
Forest management tools for forest planning
|
Exception handler used by the Excel add-in that accumulates build exceptions instead of throwing. More...
#include <FMTExcelExceptionHandler.h>
Public Member Functions | |
| std::unordered_map< int, std::vector< std::string > > | getBuildExceptions () const |
| Return the build exceptions accumulated by the handler. | |
| void | resetBuildExceptions () |
| Clear the accumulated build exceptions. | |
| virtual FMTException | raise (FMTexc lexception, std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty, bool throwit=true) |
| Override the base class raise function to accumulate build exceptions. See FMTExceptionHandler::raise. | |
| FMTExcelExceptionHandler () | |
| Default constructor for FMTExcelExceptionHandler. | |
| virtual std::unique_ptr< FMTExceptionHandler > | clone () const |
| clone the FMTExcelExceptionHandler. | |
Public Member Functions inherited from Exception::FMTExceptionHandler | |
| void | checkSignals () const |
| Check signals in R and Python if on the main thread. | |
| FMTExceptionHandler () | |
| Default constructor for FMTExceptionHandler. | |
| virtual | ~FMTExceptionHandler ()=default |
| Default virtual destructor for FMTExceptionHandler. | |
| FMTExceptionHandler (const FMTExceptionHandler &rhs) | |
| Copy constructor for FMTExceptionHandler. | |
| FMTExceptionHandler (const std::unique_ptr< Logging::FMTLogger > &logger) | |
| Construct a FMTExceptionHandler with a logger. | |
| void | passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger) |
| Pass a logger to the shared pointer of the handler for sharing. | |
| virtual FMTExceptionHandler * | getCplData () |
| Return a copy of the abstract handler for use in the FMTCPLErrorHandler function when using GDAL. | |
| virtual void | handelCplError (int eErrClass, int nError, const char *pszErrorMsg) |
| Callback called by GDAL for handling GDAL errors thrown. | |
| FMTExceptionHandler & | operator= (const FMTExceptionHandler &rhs) |
| Default copy assignment operator for FMTExceptionHandler. | |
| void | throwNested (const std::exception &texception, int &level, bool rethrow=true) |
| Throw a nested exception. | |
| virtual void | printExceptions (std::string text, const std::string &method, const int &line, const std::string &fil, Core::FMTsection lsection=Core::FMTsection::Empty) |
| Print all nested exceptions starting with the first provided. | |
| virtual FMTException | raise (FMTexc lexception, std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty, bool throwit=true) |
| Throw a FMTException based on the exception type, section, message and source location. Also used for warnings. | |
| virtual FMTException | raiseFromCatch (std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty) |
| Raise an exception from a catch body, determining if the exception is unhandled. | |
| void | raiseFromThreadCatch (std::string text, const std::string &method, const int &line, const std::string &file, Core::FMTsection lsection=Core::FMTsection::Empty) |
| Raise an exception from a catch body on a worker thread, catching all exceptions and printing them without throwing. | |
| void | reRaiseIfThreadCrash () |
| Re-raise a multithread error if an exception was raised by any thread. | |
| void | enableNestedExceptions () |
| Enable the throwing of nested exceptions. | |
| void | disableNestedExceptions () |
| Disable the throwing of nested exceptions. | |
| void | setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors) |
| Set a list of errors to be cast to warnings. | |
| void | setMaxWarningsBeforeSilenced (const size_t &maxwarningcount) |
| Setter for the maximum number of warnings before they are silenced. | |
| virtual std::unique_ptr< FMTExceptionHandler > | clone () const =0 |
| clone the FMTExceptionHandler | |
Additional Inherited Members | |
Static Public Member Functions inherited from Exception::FMTExceptionHandler | |
| static std::string | getErrorDescription (bool p_french, FMTexc p_type) |
| get descriptions of the potential errors | |
| static std::vector< FMTexc > | getErrorsToIgnore () |
| gives you a vector of error you can safely turn into warning using setErrorsToWarning return a vector of FMTexc | |
Protected Member Functions inherited from Exception::FMTExceptionHandler | |
| void | _updateStatus (std::unique_ptr< FMTException > &p_exception) |
| Update the status of the handler of the last exception type thrown and modify if it as to be ignored. | |
| bool | _needToRethrow () const |
| Return true if nested exceptions are used and the exception is a function error that must be rethrown. | |
| bool | _isMainThread () const |
| Return true if we are on the main thread. | |
| bool | _isThrowedOnThread () const |
| Return true if an exception has been thrown on a thread. | |
| bool | _isThisThreadThrowed () const |
| Return true if this thread has thrown. | |
| void | _registerWorkerThread () |
| Register a worker thread so the handler knows it is dealing with a slave thread and not the main one. | |
| bool | _isThreadRegistered () const |
| Return true if the thread is registered. | |
| void | _gutsOfPrintExceptions (std::string text, const std::string &method, const int &line, const std::string &fil, int &levelreference, Core::FMTsection lsection=Core::FMTsection::Empty, bool logfirstlevel=true) |
| The guts of printExceptions. | |
| void | _gutsOfExceptionLog (const std::exception &texception, const int &level) |
| The guts of logging exceptions. | |
| void | _updateWarningCount (const FMTException &p_warning) |
| update the warning count and print if max not reached | |
Static Protected Member Functions inherited from Exception::FMTExceptionHandler | |
| static std::unique_ptr< FMTException > | _createException (FMTexc p_exception, Core::FMTsection p_section, const std::string &p_message, const std::string &p_method, const std::string &p_file, int p_line) |
| Construct a FMTException from an exception type, a section, a message and the location where it occurred. | |
Protected Attributes inherited from Exception::FMTExceptionHandler | |
| FMTexc | _exception |
| This is the type of the last FMTException thrown by the FMTExceptionHandler. | |
| int | _errorcount |
| Keeps count of the number of error thrown. | |
| size_t | m_maxwarningsbeforesilenced |
| Number of time that the handler throw a certain warning before stop throwing it. | |
| Logging::FMTLogger * | _logger |
| pointer to the logger used to print the warning / error. | |
| bool | m_usenestedexceptions |
| If usenested = true then the handler will throw nested exceptions. | |
| boost::recursive_mutex | m_mtx |
| Mutex for multi-threading. | |
| std::vector< Exception::FMTexc > | m_errorstowarnings |
| If an error is in this list it's going to processed like a warning. | |
| std::set< boost::thread::id > | m_registered_threads |
| This is the level of the last FMTException thrown by the FMTExceptionHandler. | |
| std::exception_ptr | m_threadcrashexception |
| The exception throwed by the faulty thread... | |
Static Protected Attributes inherited from Exception::FMTExceptionHandler | |
| static boost::thread::id | m_mainthreadid |
| Main thread id. | |
| static boost::thread::id | m_crashedthreadid |
| The thread id of the crashed thread. | |
Exception handler used by the Excel add-in that accumulates build exceptions instead of throwing.
| Exception::FMTExcelExceptionHandler::FMTExcelExceptionHandler | ( | ) |
Default constructor for FMTExcelExceptionHandler.
|
virtual |
clone the FMTExcelExceptionHandler.
Implements Exception::FMTExceptionHandler.
| std::unordered_map< int, std::vector< std::string > > Exception::FMTExcelExceptionHandler::getBuildExceptions | ( | ) | const |
Return the build exceptions accumulated by the handler.
|
virtual |
Override the base class raise function to accumulate build exceptions. See FMTExceptionHandler::raise.
| [in] | lexception | the exception type. |
| [in] | text | the message of the exception. |
| [in] | method | the method where the exception occurred. |
| [in] | line | the line where the exception occurred. |
| [in] | file | the file where the exception occurred. |
| [in] | lsection | the section in which the exception occurred. |
| [in] | throwit | if true throws the exception. |
Reimplemented from Exception::FMTExceptionHandler.
| void Exception::FMTExcelExceptionHandler::resetBuildExceptions | ( | ) |
Clear the accumulated build exceptions.