Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::API::ScriptRepoException Class Reference

The ScriptRepository class is intended to be used mainly by the users, who will be willing to share and download scripts for their analysis. More...

#include <ScriptRepository.h>

Inheritance diagram for Mantid::API::ScriptRepoException:

Public Member Functions

const std::string & filePath () const
 Returns the file and position where the error was caused. More...
 
 ScriptRepoException (const std::string &info, const std::string &system, const std::string &file=std::string(), int line=-1)
 
 ScriptRepoException (const std::string &info=std::string("Unknown Exception"))
 default constructor More...
 
const std::string & systemError () const
 Returns the error description with technical details on the origin and cause. More...
 
const char * what () const noexcept override
 Returns the message string. More...
 

Private Attributes

std::string m_filepath
 
std::string m_systemError
 The message returned by what() More...
 
std::string m_userInfo
 

Detailed Description

The ScriptRepository class is intended to be used mainly by the users, who will be willing to share and download scripts for their analysis.

As so, the exceptions that may occurr while operating must provide information that are usefull for them to understand what is happening, but, the Mantid Team must still be informed what happened in more techinical detail in order to be able to deal with eventually bugs.

To provide this functionality, the ScriptRepoException will be used. As a normal std::exception (the default base one used through all the Mantid Project), it allows Mantid to work as normally.

But, it extends the usage of the exception, by allowing more information to be added. Below, some examples on how to trigger exceptions.

// throw "Unknown Exception"
// After system changing errno number, for example, EACCES
// You could give the user the reason way he can not download the file.
throw ScriptRepoException(EACCES, "You can allowed to download scripts. Please,
contact the administrator");
// For more serious exception, you could provide the location where it
// were triggered.
throw ScriptRepoException(errno, "Critical Failure", __FILE__, __LINE__)
The ScriptRepository class is intended to be used mainly by the users, who will be willing to share a...

The default ScriptRepoException::what method will be used to show the user message, while it is up to whom is using the ScriptRepository to decide on using or not the techinical information through ScriptRepoException::systemError, ScriptRepoException::filePath.

Definition at line 97 of file ScriptRepository.h.

Constructor & Destructor Documentation

◆ ScriptRepoException() [1/2]

Mantid::API::ScriptRepoException::ScriptRepoException ( const std::string &  info = std::string("Unknown Exception"))
inline

default constructor

Definition at line 101 of file ScriptRepository.h.

◆ ScriptRepoException() [2/2]

Mantid::API::ScriptRepoException::ScriptRepoException ( const std::string &  info,
const std::string &  system,
const std::string &  file = std::string(),
int  line = -1 
)

Definition at line 11 of file ScriptRepository.cpp.

References m_filepath, and std::to_string().

Member Function Documentation

◆ filePath()

const std::string & Mantid::API::ScriptRepoException::filePath ( ) const
inline

Returns the file and position where the error was caused.

Definition at line 114 of file ScriptRepository.h.

◆ systemError()

const std::string & Mantid::API::ScriptRepoException::systemError ( ) const
inline

Returns the error description with technical details on the origin and cause.

Definition at line 112 of file ScriptRepository.h.

Referenced by MantidQt::API::RepoModel::handleExceptions().

◆ what()

const char * Mantid::API::ScriptRepoException::what ( ) const
overridenoexcept

Returns the message string.

Definition at line 25 of file ScriptRepository.cpp.

References m_userInfo.

Referenced by delete_thread(), download_thread(), MantidQt::API::RepoModel::handleExceptions(), and upload_thread().

Member Data Documentation

◆ m_filepath

std::string Mantid::API::ScriptRepoException::m_filepath
private

Definition at line 120 of file ScriptRepository.h.

Referenced by ScriptRepoException().

◆ m_systemError

std::string Mantid::API::ScriptRepoException::m_systemError
private

The message returned by what()

Definition at line 118 of file ScriptRepository.h.

◆ m_userInfo

std::string Mantid::API::ScriptRepoException::m_userInfo
private

Definition at line 119 of file ScriptRepository.h.

Referenced by what().


The documentation for this class was generated from the following files: