From 1694921b43fae47089dd97243009e5e781f2a597 Mon Sep 17 00:00:00 2001 From: dirk Date: Sun, 4 May 2014 19:17:36 +0000 Subject: [PATCH] Added nested exceptions to Magick++. --- Magick++/lib/Exception.cpp | 519 ++++++++++++++++++++++++++---- Magick++/lib/Magick++/Exception.h | 63 ++++ Magick++/lib/Magick++/Include.h | 5 + 3 files changed, 531 insertions(+), 56 deletions(-) diff --git a/Magick++/lib/Exception.cpp b/Magick++/lib/Exception.cpp index 80dfb9b97..acebe2819 100644 --- a/Magick++/lib/Exception.cpp +++ b/Magick++/lib/Exception.cpp @@ -19,24 +19,36 @@ using namespace std; Magick::Exception::Exception(const std::string& what_) : std::exception(), - _what(what_) + _what(what_), + _nested((Exception *) NULL) +{ +} + +Magick::Exception::Exception(const std::string& what_, + Exception* nested_) + : std::exception(), + _what(what_), + _nested(nested_) { } Magick::Exception::Exception(const Magick::Exception& original_) : exception(original_), - _what(original_._what) + _what(original_._what), + _nested((Exception *) NULL) { } Magick::Exception::~Exception() throw() { + if (_nested != (Exception *) NULL) + delete _nested; } Magick::Exception& Magick::Exception::operator=( const Magick::Exception& original_) { - if(this != &original_) + if (this != &original_) this->_what=original_._what; return(*this); } @@ -46,11 +58,26 @@ const char* Magick::Exception::what() const throw() return(_what.c_str()); } +const Magick::Exception* Magick::Exception::nested() const throw() +{ + return(_nested); +} + +void Magick::Exception::nested(Exception* nested_) throw() +{ + _nested=nested_; +} + Magick::Error::Error(const std::string& what_) : Exception(what_) { } +Magick::Error::Error(const std::string& what_,Exception *nested_) + : Exception(what_,nested_) +{ +} + Magick::Error::~Error() throw() { } @@ -60,6 +87,11 @@ Magick::ErrorBlob::ErrorBlob(const std::string& what_) { } +Magick::ErrorBlob::ErrorBlob(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorBlob::~ErrorBlob() throw() { } @@ -69,6 +101,11 @@ Magick::ErrorCache::ErrorCache(const std::string& what_) { } +Magick::ErrorCache::ErrorCache(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorCache::~ErrorCache() throw() { } @@ -78,6 +115,11 @@ Magick::ErrorCoder::ErrorCoder(const std::string& what_) { } +Magick::ErrorCoder::ErrorCoder(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorCoder::~ErrorCoder() throw() { } @@ -87,6 +129,12 @@ Magick::ErrorConfigure::ErrorConfigure(const std::string& what_) { } +Magick::ErrorConfigure::ErrorConfigure(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorConfigure::~ErrorConfigure() throw() { } @@ -96,6 +144,12 @@ Magick::ErrorCorruptImage::ErrorCorruptImage(const std::string& what_) { } +Magick::ErrorCorruptImage::ErrorCorruptImage(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorCorruptImage::~ErrorCorruptImage() throw() { } @@ -105,6 +159,12 @@ Magick::ErrorDelegate::ErrorDelegate(const std::string& what_) { } +Magick::ErrorDelegate::ErrorDelegate(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorDelegate::~ErrorDelegate()throw() { } @@ -114,6 +174,11 @@ Magick::ErrorDraw::ErrorDraw(const std::string& what_) { } +Magick::ErrorDraw::ErrorDraw(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorDraw::~ErrorDraw() throw() { } @@ -127,11 +192,23 @@ Magick::ErrorFileOpen::~ErrorFileOpen() throw() { } +Magick::ErrorFileOpen::ErrorFileOpen(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + + Magick::ErrorImage::ErrorImage(const std::string& what_) : Error(what_) { } +Magick::ErrorImage::ErrorImage(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorImage::~ErrorImage() throw() { } @@ -141,6 +218,12 @@ Magick::ErrorMissingDelegate::ErrorMissingDelegate(const std::string& what_) { } +Magick::ErrorMissingDelegate::ErrorMissingDelegate(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorMissingDelegate::~ErrorMissingDelegate() throw () { } @@ -150,6 +233,11 @@ Magick::ErrorModule::ErrorModule(const std::string& what_) { } +Magick::ErrorModule::ErrorModule(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorModule::~ErrorModule() throw() { } @@ -159,6 +247,11 @@ Magick::ErrorMonitor::ErrorMonitor(const std::string& what_) { } +Magick::ErrorMonitor::ErrorMonitor(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorMonitor::~ErrorMonitor() throw() { } @@ -168,11 +261,12 @@ Magick::ErrorOption::ErrorOption(const std::string& what_) { } -Magick::ErrorOption::~ErrorOption() throw() +Magick::ErrorOption::ErrorOption(const std::string& what_,Exception *nested_) + : Error(what_,nested_) { } -Magick::ErrorPolicy::~ErrorPolicy() throw() +Magick::ErrorOption::~ErrorOption() throw() { } @@ -181,11 +275,27 @@ Magick::ErrorPolicy::ErrorPolicy(const std::string& what_) { } +Magick::ErrorPolicy::ErrorPolicy(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + +Magick::ErrorPolicy::~ErrorPolicy() throw() +{ +} + + Magick::ErrorRegistry::ErrorRegistry(const std::string& what_) : Error(what_) { } +Magick::ErrorRegistry::ErrorRegistry(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorRegistry::~ErrorRegistry() throw() { } @@ -195,6 +305,12 @@ Magick::ErrorResourceLimit::ErrorResourceLimit(const std::string& what_) { } +Magick::ErrorResourceLimit::ErrorResourceLimit(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorResourceLimit::~ErrorResourceLimit() throw() { } @@ -204,6 +320,11 @@ Magick::ErrorStream::ErrorStream(const std::string& what_) { } +Magick::ErrorStream::ErrorStream(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorStream::~ErrorStream() throw() { } @@ -213,6 +334,11 @@ Magick::ErrorType::ErrorType(const std::string& what_) { } +Magick::ErrorType::ErrorType(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorType::~ErrorType() throw() { } @@ -222,6 +348,12 @@ Magick::ErrorUndefined::ErrorUndefined(const std::string& what_) { } +Magick::ErrorUndefined::ErrorUndefined(const std::string& what_, + Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorUndefined::~ErrorUndefined() throw() { } @@ -231,6 +363,11 @@ Magick::ErrorXServer::ErrorXServer(const std::string& what_) { } +Magick::ErrorXServer::ErrorXServer(const std::string& what_,Exception *nested_) + : Error(what_,nested_) +{ +} + Magick::ErrorXServer::~ErrorXServer() throw () { } @@ -240,6 +377,11 @@ Magick::Warning::Warning(const std::string& what_) { } +Magick::Warning::Warning(const std::string& what_,Exception *nested_) + : Exception(what_,nested_) +{ +} + Magick::Warning::~Warning() throw() { } @@ -249,6 +391,11 @@ Magick::WarningBlob::WarningBlob(const std::string& what_) { } +Magick::WarningBlob::WarningBlob(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningBlob::~WarningBlob() throw() { } @@ -258,6 +405,11 @@ Magick::WarningCache::WarningCache(const std::string& what_) { } +Magick::WarningCache::WarningCache(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningCache::~WarningCache() throw() { } @@ -267,6 +419,11 @@ Magick::WarningCoder::WarningCoder(const std::string& what_) { } +Magick::WarningCoder::WarningCoder(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningCoder::~WarningCoder() throw() { } @@ -276,6 +433,12 @@ Magick::WarningConfigure::WarningConfigure(const std::string& what_) { } +Magick::WarningConfigure::WarningConfigure(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningConfigure::~WarningConfigure() throw() { } @@ -285,6 +448,12 @@ Magick::WarningCorruptImage::WarningCorruptImage(const std::string& what_) { } +Magick::WarningCorruptImage::WarningCorruptImage(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningCorruptImage::~WarningCorruptImage() throw() { } @@ -294,6 +463,12 @@ Magick::WarningDelegate::WarningDelegate(const std::string& what_) { } +Magick::WarningDelegate::WarningDelegate(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningDelegate::~WarningDelegate() throw() { } @@ -303,6 +478,11 @@ Magick::WarningDraw::WarningDraw(const std::string& what_) { } +Magick::WarningDraw::WarningDraw(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningDraw::~WarningDraw() throw() { } @@ -312,6 +492,12 @@ Magick::WarningFileOpen::WarningFileOpen(const std::string& what_) { } +Magick::WarningFileOpen::WarningFileOpen(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningFileOpen::~WarningFileOpen() throw() { } @@ -321,6 +507,11 @@ Magick::WarningImage::WarningImage(const std::string& what_) { } +Magick::WarningImage::WarningImage(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningImage::~WarningImage() throw() { } @@ -331,6 +522,12 @@ Magick::WarningMissingDelegate::WarningMissingDelegate( { } +Magick::WarningMissingDelegate::WarningMissingDelegate( + const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningMissingDelegate::~WarningMissingDelegate() throw() { } @@ -340,6 +537,13 @@ Magick::WarningModule::WarningModule(const std::string& what_) { } +Magick::WarningModule::WarningModule(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + + Magick::WarningModule::~WarningModule() throw() { } @@ -349,6 +553,12 @@ Magick::WarningMonitor::WarningMonitor(const std::string& what_) { } +Magick::WarningMonitor::WarningMonitor(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningMonitor::~WarningMonitor() throw() { } @@ -358,25 +568,43 @@ Magick::WarningOption::WarningOption(const std::string& what_) { } -Magick::WarningPolicy::~WarningPolicy() throw() +Magick::WarningOption::WarningOption(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) { } -Magick::WarningPolicy::WarningPolicy(const std::string& what_) +Magick::WarningOption::~WarningOption() throw() +{ +} + +Magick::WarningRegistry::WarningRegistry(const std::string& what_) : Warning(what_) { } -Magick::WarningOption::~WarningOption() throw() +Magick::WarningRegistry::WarningRegistry(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) { } -Magick::WarningRegistry::WarningRegistry(const std::string& what_) +Magick::WarningRegistry::~WarningRegistry() throw() +{ +} + +Magick::WarningPolicy::WarningPolicy(const std::string& what_) : Warning(what_) { } -Magick::WarningRegistry::~WarningRegistry() throw() +Magick::WarningPolicy::WarningPolicy(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + +Magick::WarningPolicy::~WarningPolicy() throw() { } @@ -385,6 +613,12 @@ Magick::WarningResourceLimit::WarningResourceLimit(const std::string& what_) { } +Magick::WarningResourceLimit::WarningResourceLimit(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningResourceLimit::~WarningResourceLimit() throw() { } @@ -394,6 +628,12 @@ Magick::WarningStream::WarningStream(const std::string& what_) { } +Magick::WarningStream::WarningStream(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningStream::~WarningStream() throw() { } @@ -403,6 +643,11 @@ Magick::WarningType::WarningType(const std::string& what_) { } +Magick::WarningType::WarningType(const std::string& what_,Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningType::~WarningType() throw() { } @@ -412,6 +657,12 @@ Magick::WarningUndefined::WarningUndefined(const std::string& what_) { } +Magick::WarningUndefined::WarningUndefined(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningUndefined::~WarningUndefined() throw() { } @@ -421,10 +672,137 @@ Magick::WarningXServer::WarningXServer(const std::string& what_) { } +Magick::WarningXServer::WarningXServer(const std::string& what_, + Exception *nested_) + : Warning(what_,nested_) +{ +} + Magick::WarningXServer::~WarningXServer() throw() { } +std::string Magick::formatExceptionMessage(const MagickCore::ExceptionInfo *exception_) +{ + // Format error message ImageMagick-style + std::string message=SetClientName(0); + if (exception_->reason != (char *) NULL) + { + message+=std::string(": "); + message+=std::string(exception_->reason); + } + + if (exception_->description != (char *) NULL) + message += " (" + std::string(exception_->description) + ")"; + return(message); +} + +Magick::Exception* Magick::createException(const MagickCore::ExceptionInfo *exception_) +{ + std::string message=formatExceptionMessage(exception_); + switch (exception_->severity) + { + case BlobError: + case BlobFatalError: + return new ErrorBlob(message); + case BlobWarning: + return new WarningBlob(message); + case CacheError: + case CacheFatalError: + return new ErrorCache(message); + case CacheWarning: + return new WarningCache(message); + case CoderError: + case CoderFatalError: + return new ErrorCoder(message); + case CoderWarning: + return new WarningCoder(message); + case ConfigureError: + case ConfigureFatalError: + return new ErrorConfigure(message); + case ConfigureWarning: + return new WarningConfigure(message); + case CorruptImageError: + case CorruptImageFatalError: + return new ErrorCorruptImage(message); + case CorruptImageWarning: + return new WarningCorruptImage(message); + case DelegateError: + case DelegateFatalError: + return new ErrorDelegate(message); + case DelegateWarning: + return new WarningDelegate(message); + case DrawError: + case DrawFatalError: + return new ErrorDraw(message); + case DrawWarning: + return new WarningDraw(message); + case FileOpenError: + case FileOpenFatalError: + return new ErrorFileOpen(message); + case FileOpenWarning: + return new WarningFileOpen(message); + case ImageError: + case ImageFatalError: + return new ErrorImage(message); + case ImageWarning: + return new WarningImage(message); + case MissingDelegateError: + case MissingDelegateFatalError: + return new ErrorMissingDelegate(message); + case MissingDelegateWarning: + return new WarningMissingDelegate(message); + case ModuleError: + case ModuleFatalError: + return new ErrorModule(message); + case ModuleWarning: + return new WarningModule(message); + case MonitorError: + case MonitorFatalError: + return new ErrorMonitor(message); + case MonitorWarning: + return new WarningMonitor(message); + case OptionError: + case OptionFatalError: + return new ErrorOption(message); + case OptionWarning: + return new WarningOption(message); + case PolicyWarning: + return new WarningPolicy(message); + case PolicyError: + case PolicyFatalError: + return new ErrorPolicy(message); + case RegistryError: + case RegistryFatalError: + return new ErrorRegistry(message); + case RegistryWarning: + return new WarningRegistry(message); + case ResourceLimitError: + case ResourceLimitFatalError: + return new ErrorResourceLimit(message); + case ResourceLimitWarning: + return new WarningResourceLimit(message); + case StreamError: + case StreamFatalError: + return new ErrorStream(message); + case StreamWarning: + return new WarningStream(message); + case TypeError: + case TypeFatalError: + return new ErrorType(message); + case TypeWarning: + return new WarningType(message); + case UndefinedException: + default: + return new ErrorUndefined(message); + case XServerError: + case XServerFatalError: + return new ErrorXServer(message); + case XServerWarning: + return new WarningXServer(message); + } +} + MagickPPExport void Magick::throwExceptionExplicit( const ExceptionType severity_,const char* reason_,const char* description_) { @@ -442,6 +820,13 @@ MagickPPExport void Magick::throwExceptionExplicit( MagickPPExport void Magick::throwException(ExceptionInfo &exception_) { + const ExceptionInfo + *p; + + Exception + *nestedException, + *q; + ExceptionType severity; @@ -452,17 +837,34 @@ MagickPPExport void Magick::throwException(ExceptionInfo &exception_) if (exception_.severity == UndefinedException) return; - // Format error message ImageMagick-style - std::string message = SetClientName(0); - if (exception_.reason != (char *) NULL) + std::string message=formatExceptionMessage(&exception_); + nestedException=(Exception *) NULL; + LockSemaphoreInfo(exception_.semaphore); + if (exception_.exceptions != (void *) NULL) { - message+=std::string(": "); - message+=std::string(exception_.reason); + ResetLinkedListIterator((LinkedListInfo *) exception_.exceptions); + p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) + exception_.exceptions); + while (p != (const ExceptionInfo *) NULL) + { + if ((p->severity != exception_.severity) || (LocaleCompare(p->reason, + exception_.reason) != 0) || (LocaleCompare(p->description, + exception_.description) != 0)) + { + if (nestedException == (Exception *) NULL) + nestedException=createException(p); + else + { + q=createException(p); + nestedException->nested(q); + nestedException=q; + } + } + p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) + exception_.exceptions); + } } - - if (exception_.description != (char *) NULL) - message += " (" + std::string(exception_.description) + ")"; - + UnlockSemaphoreInfo(exception_.semaphore); severity=exception_.severity; relinquish=exception_.relinquish; DestroyExceptionInfo(&exception_); @@ -473,96 +875,101 @@ MagickPPExport void Magick::throwException(ExceptionInfo &exception_) { case BlobError: case BlobFatalError: - throw ErrorBlob(message); + throw ErrorBlob(message,nestedException); case BlobWarning: - throw WarningBlob(message); + throw WarningBlob(message,nestedException); case CacheError: case CacheFatalError: - throw ErrorCache(message); + throw ErrorCache(message,nestedException); case CacheWarning: - throw WarningCache(message); + throw WarningCache(message,nestedException); case CoderError: case CoderFatalError: - throw ErrorCoder(message); + throw ErrorCoder(message,nestedException); case CoderWarning: - throw WarningCoder(message); + throw WarningCoder(message,nestedException); case ConfigureError: case ConfigureFatalError: - throw ErrorConfigure(message); + throw ErrorConfigure(message,nestedException); case ConfigureWarning: - throw WarningConfigure(message); + throw WarningConfigure(message,nestedException); case CorruptImageError: case CorruptImageFatalError: - throw ErrorCorruptImage(message); + throw ErrorCorruptImage(message,nestedException); case CorruptImageWarning: - throw WarningCorruptImage(message); + throw WarningCorruptImage(message,nestedException); case DelegateError: case DelegateFatalError: - throw ErrorDelegate(message); + throw ErrorDelegate(message,nestedException); case DelegateWarning: - throw WarningDelegate(message); + throw WarningDelegate(message,nestedException); case DrawError: case DrawFatalError: - throw ErrorDraw(message); + throw ErrorDraw(message,nestedException); case DrawWarning: - throw WarningDraw(message); + throw WarningDraw(message,nestedException); case FileOpenError: case FileOpenFatalError: - throw ErrorFileOpen(message); + throw ErrorFileOpen(message,nestedException); case FileOpenWarning: - throw WarningFileOpen(message); + throw WarningFileOpen(message,nestedException); case ImageError: case ImageFatalError: - throw ErrorImage(message); + throw ErrorImage(message,nestedException); case ImageWarning: - throw WarningImage(message); + throw WarningImage(message,nestedException); case MissingDelegateError: case MissingDelegateFatalError: - throw ErrorMissingDelegate(message); + throw ErrorMissingDelegate(message,nestedException); case MissingDelegateWarning: - throw WarningMissingDelegate(message); + throw WarningMissingDelegate(message,nestedException); case ModuleError: case ModuleFatalError: - throw ErrorModule(message); + throw ErrorModule(message,nestedException); case ModuleWarning: - throw WarningModule(message); + throw WarningModule(message,nestedException); case MonitorError: case MonitorFatalError: - throw ErrorMonitor(message); + throw ErrorMonitor(message,nestedException); case MonitorWarning: - throw WarningMonitor(message); + throw WarningMonitor(message,nestedException); case OptionError: case OptionFatalError: - throw ErrorOption(message); + throw ErrorOption(message,nestedException); case OptionWarning: - throw WarningOption(message); + throw WarningOption(message,nestedException); + case PolicyWarning: + throw WarningPolicy(message,nestedException); + case PolicyError: + case PolicyFatalError: + throw ErrorPolicy(message,nestedException); case RegistryError: case RegistryFatalError: - throw ErrorRegistry(message); + throw ErrorRegistry(message,nestedException); case RegistryWarning: - throw WarningRegistry(message); + throw WarningRegistry(message,nestedException); case ResourceLimitError: case ResourceLimitFatalError: - throw ErrorResourceLimit(message); + throw ErrorResourceLimit(message,nestedException); case ResourceLimitWarning: - throw WarningResourceLimit(message); + throw WarningResourceLimit(message,nestedException); case StreamError: case StreamFatalError: - throw ErrorStream(message); + throw ErrorStream(message,nestedException); case StreamWarning: - throw WarningStream(message); + throw WarningStream(message,nestedException); case TypeError: case TypeFatalError: - throw ErrorType(message); + throw ErrorType(message,nestedException); case TypeWarning: - throw WarningType(message); + throw WarningType(message,nestedException); case UndefinedException: default: - throw ErrorUndefined(message); + throw ErrorUndefined(message,nestedException); case XServerError: case XServerFatalError: - throw ErrorXServer(message); + throw ErrorXServer(message,nestedException); case XServerWarning: - throw WarningXServer(message); + throw WarningXServer(message,nestedException); } } \ No newline at end of file diff --git a/Magick++/lib/Magick++/Exception.h b/Magick++/lib/Magick++/Exception.h index a99e41de2..e29863f99 100644 --- a/Magick++/lib/Magick++/Exception.h +++ b/Magick++/lib/Magick++/Exception.h @@ -25,6 +25,9 @@ namespace Magick // Construct with message string Exception(const std::string& what_); + // Construct with message string and nested exception + Exception(const std::string& what_, Exception* nested_); + // Copy constructor Exception(const Exception& original_); @@ -37,8 +40,20 @@ namespace Magick // Get string identifying exception virtual const char* what() const throw(); + // Get nested exception + const Exception* nested() const throw(); + + ////////////////////////////////////////////////////////////////////// + // + // No user-serviceable parts beyond this point + // + ////////////////////////////////////////////////////////////////////// + + void nested(Exception* nested_) throw(); + private: std::string _what; + Exception* _nested; }; // @@ -49,6 +64,7 @@ namespace Magick { public: explicit Error(const std::string& what_); + explicit Error(const std::string& what_,Exception *nested_); ~Error() throw(); }; @@ -56,6 +72,7 @@ namespace Magick { public: explicit ErrorBlob(const std::string& what_); + explicit ErrorBlob(const std::string& what_,Exception *nested_); ~ErrorBlob() throw(); }; @@ -63,6 +80,7 @@ namespace Magick { public: explicit ErrorCache(const std::string& what_); + explicit ErrorCache(const std::string& what_,Exception *nested_); ~ErrorCache() throw(); }; @@ -70,6 +88,7 @@ namespace Magick { public: explicit ErrorCoder(const std::string& what_); + explicit ErrorCoder(const std::string& what_,Exception *nested_); ~ErrorCoder() throw(); }; @@ -77,6 +96,7 @@ namespace Magick { public: explicit ErrorConfigure(const std::string& what_); + explicit ErrorConfigure(const std::string& what_,Exception *nested_); ~ErrorConfigure() throw(); }; @@ -84,6 +104,7 @@ namespace Magick { public: explicit ErrorCorruptImage(const std::string& what_); + explicit ErrorCorruptImage(const std::string& what_,Exception *nested_); ~ErrorCorruptImage() throw(); }; @@ -91,6 +112,7 @@ namespace Magick { public: explicit ErrorDelegate(const std::string& what_); + explicit ErrorDelegate(const std::string& what_,Exception *nested_); ~ErrorDelegate() throw(); }; @@ -98,6 +120,7 @@ namespace Magick { public: explicit ErrorDraw(const std::string& what_); + explicit ErrorDraw(const std::string& what_,Exception *nested_); ~ErrorDraw() throw(); }; @@ -105,6 +128,7 @@ namespace Magick { public: explicit ErrorFileOpen(const std::string& what_); + explicit ErrorFileOpen(const std::string& what_,Exception *nested_); ~ErrorFileOpen() throw(); }; @@ -112,6 +136,7 @@ namespace Magick { public: explicit ErrorImage(const std::string& what_); + explicit ErrorImage(const std::string& what_,Exception *nested_); ~ErrorImage() throw(); }; @@ -119,6 +144,7 @@ namespace Magick { public: explicit ErrorMissingDelegate(const std::string& what_); + explicit ErrorMissingDelegate(const std::string& what_,Exception *nested_); ~ErrorMissingDelegate() throw(); }; @@ -126,6 +152,7 @@ namespace Magick { public: explicit ErrorModule(const std::string& what_); + explicit ErrorModule(const std::string& what_,Exception *nested_); ~ErrorModule() throw(); }; @@ -133,6 +160,7 @@ namespace Magick { public: explicit ErrorMonitor(const std::string& what_); + explicit ErrorMonitor(const std::string& what_,Exception *nested_); ~ErrorMonitor() throw(); }; @@ -140,6 +168,7 @@ namespace Magick { public: explicit ErrorOption(const std::string& what_); + explicit ErrorOption(const std::string& what_,Exception *nested_); ~ErrorOption() throw(); }; @@ -147,6 +176,7 @@ namespace Magick { public: explicit ErrorPolicy(const std::string& what_); + explicit ErrorPolicy(const std::string& what_,Exception *nested_); ~ErrorPolicy() throw(); }; @@ -154,6 +184,7 @@ namespace Magick { public: explicit ErrorRegistry(const std::string& what_); + explicit ErrorRegistry(const std::string& what_,Exception *nested_); ~ErrorRegistry() throw(); }; @@ -161,6 +192,7 @@ namespace Magick { public: explicit ErrorResourceLimit(const std::string& what_); + explicit ErrorResourceLimit(const std::string& what_,Exception *nested_); ~ErrorResourceLimit() throw(); }; @@ -168,6 +200,7 @@ namespace Magick { public: explicit ErrorStream(const std::string& what_); + explicit ErrorStream(const std::string& what_,Exception *nested_); ~ErrorStream() throw(); }; @@ -175,6 +208,7 @@ namespace Magick { public: explicit ErrorType(const std::string& what_); + explicit ErrorType(const std::string& what_,Exception *nested_); ~ErrorType() throw(); }; @@ -182,6 +216,7 @@ namespace Magick { public: explicit ErrorUndefined(const std::string& what_); + explicit ErrorUndefined(const std::string& what_,Exception *nested_); ~ErrorUndefined() throw(); }; @@ -189,6 +224,7 @@ namespace Magick { public: explicit ErrorXServer(const std::string& what_); + explicit ErrorXServer(const std::string& what_,Exception *nested_); ~ErrorXServer() throw(); }; @@ -200,6 +236,7 @@ namespace Magick { public: explicit Warning(const std::string& what_); + explicit Warning(const std::string& what_,Exception *nested_); ~Warning() throw(); }; @@ -207,6 +244,7 @@ namespace Magick { public: explicit WarningBlob(const std::string& what_); + explicit WarningBlob(const std::string& what_,Exception *nested_); ~WarningBlob() throw(); }; @@ -214,6 +252,7 @@ namespace Magick { public: explicit WarningCache(const std::string& what_); + explicit WarningCache(const std::string& what_,Exception *nested_); ~WarningCache() throw(); }; @@ -221,6 +260,7 @@ namespace Magick { public: explicit WarningCoder(const std::string& what_); + explicit WarningCoder(const std::string& what_,Exception *nested_); ~WarningCoder() throw(); }; @@ -228,6 +268,7 @@ namespace Magick { public: explicit WarningConfigure(const std::string& what_); + explicit WarningConfigure(const std::string& what_,Exception *nested_); ~WarningConfigure() throw(); }; @@ -235,6 +276,7 @@ namespace Magick { public: explicit WarningCorruptImage(const std::string& what_); + explicit WarningCorruptImage(const std::string& what_,Exception *nested_); ~WarningCorruptImage() throw(); }; @@ -242,6 +284,7 @@ namespace Magick { public: explicit WarningDelegate(const std::string& what_); + explicit WarningDelegate(const std::string& what_,Exception *nested_); ~WarningDelegate() throw(); }; @@ -249,6 +292,7 @@ namespace Magick { public: explicit WarningDraw(const std::string& what_); + explicit WarningDraw(const std::string& what_,Exception *nested_); ~WarningDraw() throw(); }; @@ -256,6 +300,7 @@ namespace Magick { public: explicit WarningFileOpen(const std::string& what_); + explicit WarningFileOpen(const std::string& what_,Exception *nested_); ~WarningFileOpen() throw(); }; @@ -263,6 +308,7 @@ namespace Magick { public: explicit WarningImage(const std::string& what_); + explicit WarningImage(const std::string& what_,Exception *nested_); ~WarningImage() throw(); }; @@ -270,6 +316,8 @@ namespace Magick { public: explicit WarningMissingDelegate(const std::string& what_); + explicit WarningMissingDelegate(const std::string& what_, + Exception *nested_); ~WarningMissingDelegate() throw(); }; @@ -277,6 +325,7 @@ namespace Magick { public: explicit WarningModule(const std::string& what_); + explicit WarningModule(const std::string& what_,Exception *nested_); ~WarningModule() throw(); }; @@ -284,6 +333,7 @@ namespace Magick { public: explicit WarningMonitor(const std::string& what_); + explicit WarningMonitor(const std::string& what_,Exception *nested_); ~WarningMonitor() throw(); }; @@ -291,6 +341,7 @@ namespace Magick { public: explicit WarningOption(const std::string& what_); + explicit WarningOption(const std::string& what_,Exception *nested_); ~WarningOption() throw(); }; @@ -298,6 +349,7 @@ namespace Magick { public: explicit WarningPolicy(const std::string& what_); + explicit WarningPolicy(const std::string& what_,Exception *nested_); ~WarningPolicy() throw(); }; @@ -305,6 +357,7 @@ namespace Magick { public: explicit WarningRegistry(const std::string& what_); + explicit WarningRegistry(const std::string& what_,Exception *nested_); ~WarningRegistry() throw(); }; @@ -312,6 +365,7 @@ namespace Magick { public: explicit WarningResourceLimit(const std::string& what_); + explicit WarningResourceLimit(const std::string& what_,Exception *nested_); ~WarningResourceLimit() throw(); }; @@ -319,6 +373,7 @@ namespace Magick { public: explicit WarningStream(const std::string& what_); + explicit WarningStream(const std::string& what_,Exception *nested_); ~WarningStream() throw(); }; @@ -326,6 +381,7 @@ namespace Magick { public: explicit WarningType(const std::string& what_); + explicit WarningType(const std::string& what_,Exception *nested_); ~WarningType() throw(); }; @@ -333,6 +389,7 @@ namespace Magick { public: explicit WarningUndefined(const std::string& what_); + explicit WarningUndefined(const std::string& what_,Exception *nested_); ~WarningUndefined() throw(); }; @@ -340,6 +397,7 @@ namespace Magick { public: explicit WarningXServer(const std::string& what_); + explicit WarningXServer(const std::string& what_,Exception *nested_); ~WarningXServer() throw(); }; @@ -347,6 +405,11 @@ namespace Magick // No user-serviceable components beyond this point. // + std::string formatExceptionMessage( + const MagickCore::ExceptionInfo *exception_); + + Exception* createException(const MagickCore::ExceptionInfo *exception_); + // Throw exception based on raw data extern MagickPPExport void throwExceptionExplicit( const MagickCore::ExceptionType severity_,const char* reason_, diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 750f9953f..12e1f0e5a 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -1234,6 +1234,7 @@ namespace Magick using MagickCore::GetImageType; using MagickCore::GetMagickInfo; using MagickCore::GetMultilineTypeMetrics; + using MagickCore::GetNextValueInLinkedList; using MagickCore::GetPixelBlue; using MagickCore::GetPixelGreen; using MagickCore::GetPixelInfo; @@ -1273,8 +1274,10 @@ namespace Magick using MagickCore::LevelImage; using MagickCore::LevelImageColors; using MagickCore::LinearStretchImage; + using MagickCore::LinkedListInfo; using MagickCore::LiquidRescaleImage; using MagickCore::LocaleCompare; + using MagickCore::LockSemaphoreInfo; using MagickCore::LogMagickEvent; using MagickCore::MagickCoreTerminus; using MagickCore::MagickInfo; @@ -1344,6 +1347,7 @@ namespace Magick using MagickCore::RelinquishMagickMemory; using MagickCore::RemapImage; using MagickCore::ResampleImage; + using MagickCore::ResetLinkedListIterator; using MagickCore::ResizeImage; using MagickCore::ResizeMagickMemory; using MagickCore::ResourceLimitError; @@ -1424,6 +1428,7 @@ namespace Magick using MagickCore::UndefinedException; using MagickCore::UndefinedRegistryType; using MagickCore::UniqueImageColors; + using MagickCore::UnlockSemaphoreInfo; using MagickCore::UnregisterMagickInfo; using MagickCore::UnsharpMaskImage; using MagickCore::VignetteImage; -- 2.50.1