Definition in file exceptions.h.
#include <string>
#include <sstream>
#include <exception>
#include "EDoc/Logger.h"
Go to the source code of this file.
Namespaces | |
namespace | EDoc |
Data Structures | |
class | EDoc::Throwable |
Base class from which all EDoc exception types will derive. More... | |
class | EDoc::BugException |
class | EDoc::BaseException |
class | EDoc::MergeException |
class | EDoc::PythonException |
class | EDoc::FileIOException |
class | EDoc::EOFException |
class | EDoc::UnknownFileTypeException |
Defines | |
#define | EDOC_THROW_DATA __FILE__, __LINE__ |
Gathers the current file name and line number to give to an exception object upon construction. | |
#define | EDOC_THROW_EXCEPTION(ExceptionType, UserMessage, DevMessage) |
Use this macro to simplify throwing of all exceptions. | |
#define | EDOC_ASSERT(Condition, Message) |
An assertion statement that will throw an exception of type BugException if the assertion fails. | |
#define | EDOC_NEW_EXCEPTION(NewExceptionType, BaseExceptionType) |
Macro defined to simply create a new exception type. |
#define EDOC_ASSERT | ( | Condition, | |||
Message | ) |
Value:
{ \ if (!(Condition)) \ { \ EDOC_Fatal("Assertion failure. \"" << #Condition << "\"" \ << " : " << Message); \ EDOC_THROW_EXCEPTION(::EDoc::BugException, "Assertion failure.", \ #Condition << " : " << Message); \ } \ else \ { \ EDOC_Finest("Assertion success. \"" << #Condition << "\""); \ } \ }
The BugException is not supposed to be caught except in the main() function.
Definition at line 70 of file exceptions.h.
Referenced by EDoc::AllocNew(), EDoc::ManagedObject::CAdd(), EDoc::CalculateTotalFunctionCalls(), EDoc::ManagedObject::CRemove(), EDoc::FunctionLoc::FunctionLoc(), EDoc::Function::GetCircleSet(), EDoc::GetCurrentDictionaryAssert(), EDoc::GetGlobalNotifierAssert(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::Dictionary::GetTranslationUnitIndex(), EDoc::Dictionary::HandleCircularCallgraph(), EDoc::ManagedObject::ManagedObject(), EDoc::Type::Merge(), EDoc::Dictionary::Merge(), EDoc::PropogatingException::operator=(), EDoc::ManagedObject::operator=(), EDoc::Persistence::Persistence(), EDoc::Dictionary::ProcessFunction(), EDoc::PropogatingException::PropogatingException(), EDoc::Dictionary::Read(), EDoc::Function::RemoveFromCircular(), EDoc::Function::ReplaceReferences(), EDoc::StringIdentifiedObject::SetKeyName(), EDoc::TypeLoc::Validate(), EDoc::Type::Validate(), EDoc::TryBlock::Validate(), EDoc::PropogatingException::Validate(), EDoc::ManagedObject::Validate(), EDoc::Location::Validate(), EDoc::FunctionTypeLoc::Validate(), EDoc::FunctionType::Validate(), EDoc::FunctionLoc::Validate(), EDoc::Function::Validate(), EDoc::File::Validate(), EDoc::Exception::Validate(), EDoc::Dictionary::Validate(), EDoc::CodeBlock::Validate(), EDoc::CatchBlock::Validate(), EDoc::FunctionLoc::Write(), EDoc::Exception::Write(), EDoc::StackRef::~StackRef(), and EDoc::StdErrNotifier::~StdErrNotifier().
#define EDOC_NEW_EXCEPTION | ( | NewExceptionType, | |||
BaseExceptionType | ) |
Value:
class NewExceptionType : public BaseExceptionType \ { \ public: \ NewExceptionType(const char* type_name_in,\ const char* file_in, \ int line_in, \ std::string user_message_in = "", \ std::string dev_message_in = "") : \ \ BaseExceptionType(type_name_in, file_in, line_in, user_message_in, \ dev_message_in) \ { \ } \ \ NewExceptionType(const char* file_in, \ int line_in, \ std::string user_message_in = "", \ std::string dev_message_in = "") : \ \ BaseExceptionType(#NewExceptionType, file_in, line_in, \ user_message_in, dev_message_in) \ { \ } \ };
This can be used for creating simple exception types that have the standard functionality of the EDoc::Throwable type.
NewExceptionType | The name of the new exception type to create. | |
BaseExceptionType | The name of the exception type that the new one will derive from. |
Definition at line 97 of file exceptions.h.
#define EDOC_THROW_DATA __FILE__, __LINE__ |
Gathers the current file name and line number to give to an exception object upon construction.
Definition at line 37 of file exceptions.h.
#define EDOC_THROW_EXCEPTION | ( | ExceptionType, | |||
UserMessage, | |||||
DevMessage | ) |
Value:
{ \ std::ostringstream stream_kjhgbvk791; \ std::ostringstream stream_kjhgbvk792; \ stream_kjhgbvk791 << UserMessage; \ stream_kjhgbvk792 << DevMessage; \ throw ExceptionType (EDOC_THROW_DATA, stream_kjhgbvk791.str(), \ stream_kjhgbvk792.str()); \ }
This will gather source information like file name and line number, along with allowing the user to specify additional debug information to a string stream when throwing an exception.
It is used like:
... EDOC_THROW_EXCEPTION(MergeException, strerror(errno), "More detailed developer message. Data: " << data);
Definition at line 54 of file exceptions.h.
Referenced by EDoc::IndexedObject::CAdd(), EDoc::CopyFile(), EDoc::CreateTempFilename(), EDocBFD::EmbedFileInBinary(), EDoc::GetAllFiles(), EDoc::TextPersistence::GetNextLine(), EDocBFD::HandleEDocSection(), EDoc::Logger::InitialiseFile(), EDoc::Type::IsCaughtBy(), EDoc::MakeTemporaryFile(), EDoc::MkDirs(), EDoc::TextPersistence::Open(), EDoc::BinaryPersistence::Open(), EDocBFD::OpenBFDFile(), EDoc::Persistence::Persistence(), EDocBFD::ProcessReadBFD(), EDocBFD::Section::Read(), EDoc::Function::Read(), EDoc::Dictionary::Read(), EDoc::TextPersistence::ReadBoolean(), EDoc::BinaryPersistence::ReadBoolean(), EDoc::BinaryPersistence::ReadData(), EDocBFD::Section::ReadEx(), EDoc::TextPersistence::ReadInt32(), EDoc::BinaryPersistence::ReadString(), EDoc::TextPersistence::ReadUInt32(), EDoc::BinaryPersistence::ReadUInt32(), EDoc::TextPersistence::ReadUInt8(), EDoc::BinaryPersistence::ReadUInt8(), EDoc::TextPersistence::ReadValue(), EDoc::RunProgram(), EDoc::RunProgramRedirect(), EDocBFD::Section::Write(), EDoc::TextPersistence::WriteBoolean(), EDoc::BinaryPersistence::WriteBoolean(), EDoc::TextPersistence::WriteInt32(), EDoc::TextPersistence::WriteInt32Debug(), EDocBFD::BFDArchive::WriteOpen(), EDoc::BinaryPersistence::WriteRecordType(), EDoc::TextPersistence::WriteString(), EDoc::BinaryPersistence::WriteString(), EDoc::TextPersistence::WriteUInt32(), EDoc::BinaryPersistence::WriteUInt32(), EDoc::TextPersistence::WriteUInt32Debug(), EDoc::TextPersistence::WriteUInt8(), and EDoc::BinaryPersistence::WriteUInt8().