1// This may look like C code, but it is really -*- C++ -*-
2//
3// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4// Copyright Dirk Lemstra 2014-2015
5//
6// Implementation of Exception and derived classes
7//
8
9#define MAGICKCORE_IMPLEMENTATION  1
10#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11
12#include "Magick++/Include.h"
13#include <string>
14#include <errno.h>
15#include <string.h>
16
17using namespace std;
18
19#include "Magick++/Exception.h"
20
21Magick::Exception::Exception(const std::string& what_)
22  : std::exception(),
23    _what(what_),
24    _nested((Exception *) NULL)
25{
26}
27
28Magick::Exception::Exception(const std::string& what_,
29  Exception* nested_)
30    : std::exception(),
31    _what(what_),
32    _nested(nested_)
33{
34}
35
36Magick::Exception::Exception(const Magick::Exception& original_)
37  : exception(original_),
38    _what(original_._what),
39    _nested((Exception *) NULL)
40{
41}
42
43Magick::Exception::~Exception() throw()
44{
45  if (_nested != (Exception *) NULL)
46    delete _nested;
47}
48
49Magick::Exception& Magick::Exception::operator=(
50  const Magick::Exception& original_)
51{
52  if (this != &original_)
53    this->_what=original_._what;
54  return(*this);
55}
56
57const char* Magick::Exception::what() const throw()
58{
59  return(_what.c_str());
60}
61
62const Magick::Exception* Magick::Exception::nested() const throw()
63{
64  return(_nested);
65}
66
67void Magick::Exception::nested(Exception* nested_) throw()
68{
69  _nested=nested_;
70}
71
72Magick::Error::Error(const std::string& what_)
73  : Exception(what_)
74{
75}
76
77Magick::Error::Error(const std::string& what_,Exception *nested_)
78  : Exception(what_,nested_)
79{
80}
81
82Magick::Error::~Error() throw()
83{
84}
85
86Magick::ErrorBlob::ErrorBlob(const std::string& what_)
87  : Error(what_)
88{
89}
90
91Magick::ErrorBlob::ErrorBlob(const std::string& what_,Exception *nested_)
92  : Error(what_,nested_)
93{
94}
95
96Magick::ErrorBlob::~ErrorBlob() throw()
97{
98}
99
100Magick::ErrorCache::ErrorCache(const std::string& what_)
101  : Error(what_)
102{
103}
104
105Magick::ErrorCache::ErrorCache(const std::string& what_,Exception *nested_)
106  : Error(what_,nested_)
107{
108}
109
110Magick::ErrorCache::~ErrorCache() throw()
111{
112}
113
114Magick::ErrorCoder::ErrorCoder(const std::string& what_)
115  : Error(what_)
116{
117}
118
119Magick::ErrorCoder::ErrorCoder(const std::string& what_,Exception *nested_)
120  : Error(what_,nested_)
121{
122}
123
124Magick::ErrorCoder::~ErrorCoder() throw()
125{
126}
127
128Magick::ErrorConfigure::ErrorConfigure(const std::string& what_)
129  : Error(what_)
130{
131}
132
133Magick::ErrorConfigure::ErrorConfigure(const std::string& what_,
134  Exception *nested_)
135  : Error(what_,nested_)
136{
137}
138
139Magick::ErrorConfigure::~ErrorConfigure() throw()
140{
141}
142
143Magick::ErrorCorruptImage::ErrorCorruptImage(const std::string& what_)
144  : Error(what_)
145{
146}
147
148Magick::ErrorCorruptImage::ErrorCorruptImage(const std::string& what_,
149  Exception *nested_)
150  : Error(what_,nested_)
151{
152}
153
154Magick::ErrorCorruptImage::~ErrorCorruptImage() throw()
155{
156}
157
158Magick::ErrorDelegate::ErrorDelegate(const std::string& what_)
159  : Error(what_)
160{
161}
162
163Magick::ErrorDelegate::ErrorDelegate(const std::string& what_,
164  Exception *nested_)
165  : Error(what_,nested_)
166{
167}
168
169Magick::ErrorDelegate::~ErrorDelegate()throw()
170{
171}
172
173Magick::ErrorDraw::ErrorDraw(const std::string& what_)
174  : Error(what_)
175{
176}
177
178Magick::ErrorDraw::ErrorDraw(const std::string& what_,Exception *nested_)
179  : Error(what_,nested_)
180{
181}
182
183Magick::ErrorDraw::~ErrorDraw() throw()
184{
185}
186
187Magick::ErrorFileOpen::ErrorFileOpen(const std::string& what_)
188  : Error(what_)
189{
190}
191
192Magick::ErrorFileOpen::~ErrorFileOpen() throw()
193{
194}
195
196Magick::ErrorFileOpen::ErrorFileOpen(const std::string& what_,
197  Exception *nested_)
198  : Error(what_,nested_)
199{
200}
201
202
203Magick::ErrorImage::ErrorImage(const std::string& what_)
204  : Error(what_)
205{
206}
207
208Magick::ErrorImage::ErrorImage(const std::string& what_,Exception *nested_)
209  : Error(what_,nested_)
210{
211}
212
213Magick::ErrorImage::~ErrorImage() throw()
214{
215}
216
217Magick::ErrorMissingDelegate::ErrorMissingDelegate(const std::string& what_)
218  : Error(what_)
219{
220}
221
222Magick::ErrorMissingDelegate::ErrorMissingDelegate(const std::string& what_,
223  Exception *nested_)
224  : Error(what_,nested_)
225{
226}
227
228Magick::ErrorMissingDelegate::~ErrorMissingDelegate() throw ()
229{
230}
231
232Magick::ErrorModule::ErrorModule(const std::string& what_)
233  : Error(what_)
234{
235}
236
237Magick::ErrorModule::ErrorModule(const std::string& what_,Exception *nested_)
238  : Error(what_,nested_)
239{
240}
241
242Magick::ErrorModule::~ErrorModule() throw()
243{
244}
245
246Magick::ErrorMonitor::ErrorMonitor(const std::string& what_)
247  : Error(what_)
248{
249}
250
251Magick::ErrorMonitor::ErrorMonitor(const std::string& what_,Exception *nested_)
252  : Error(what_,nested_)
253{
254}
255
256Magick::ErrorMonitor::~ErrorMonitor() throw()
257{
258}
259
260Magick::ErrorOption::ErrorOption(const std::string& what_)
261  : Error(what_)
262{
263}
264
265Magick::ErrorOption::ErrorOption(const std::string& what_,Exception *nested_)
266  : Error(what_,nested_)
267{
268}
269
270Magick::ErrorOption::~ErrorOption() throw()
271{
272}
273
274Magick::ErrorPolicy::ErrorPolicy(const std::string& what_)
275  : Error(what_)
276{
277}
278
279Magick::ErrorPolicy::ErrorPolicy(const std::string& what_,Exception *nested_)
280  : Error(what_,nested_)
281{
282}
283
284Magick::ErrorPolicy::~ErrorPolicy() throw()
285{
286}
287
288
289Magick::ErrorRegistry::ErrorRegistry(const std::string& what_)
290  : Error(what_)
291{
292}
293
294Magick::ErrorRegistry::ErrorRegistry(const std::string& what_,
295  Exception *nested_)
296  : Error(what_,nested_)
297{
298}
299
300Magick::ErrorRegistry::~ErrorRegistry() throw()
301{
302}
303
304Magick::ErrorResourceLimit::ErrorResourceLimit(const std::string& what_)
305  : Error(what_)
306{
307}
308
309Magick::ErrorResourceLimit::ErrorResourceLimit(const std::string& what_,
310  Exception *nested_)
311  : Error(what_,nested_)
312{
313}
314
315Magick::ErrorResourceLimit::~ErrorResourceLimit() throw()
316{
317}
318
319Magick::ErrorStream::ErrorStream(const std::string& what_)
320  : Error(what_)
321{
322}
323
324Magick::ErrorStream::ErrorStream(const std::string& what_,Exception *nested_)
325  : Error(what_,nested_)
326{
327}
328
329Magick::ErrorStream::~ErrorStream() throw()
330{
331}
332
333Magick::ErrorType::ErrorType(const std::string& what_)
334  : Error(what_)
335{
336}
337
338Magick::ErrorType::ErrorType(const std::string& what_,Exception *nested_)
339  : Error(what_,nested_)
340{
341}
342
343Magick::ErrorType::~ErrorType() throw()
344{
345}
346
347Magick::ErrorUndefined::ErrorUndefined(const std::string& what_)
348  : Error(what_)
349{
350}
351
352Magick::ErrorUndefined::ErrorUndefined(const std::string& what_,
353  Exception *nested_)
354  : Error(what_,nested_)
355{
356}
357
358Magick::ErrorUndefined::~ErrorUndefined() throw()
359{
360}
361
362Magick::ErrorXServer::ErrorXServer(const std::string& what_)
363  : Error(what_)
364{
365}
366
367Magick::ErrorXServer::ErrorXServer(const std::string& what_,Exception *nested_)
368  : Error(what_,nested_)
369{
370}
371
372Magick::ErrorXServer::~ErrorXServer() throw ()
373{
374}
375
376Magick::Warning::Warning(const std::string& what_)
377  : Exception(what_)
378{
379}
380
381Magick::Warning::Warning(const std::string& what_,Exception *nested_)
382  : Exception(what_,nested_)
383{
384}
385
386Magick::Warning::~Warning() throw()
387{
388}
389
390Magick::WarningBlob::WarningBlob(const std::string& what_)
391  : Warning(what_)
392{
393}
394
395Magick::WarningBlob::WarningBlob(const std::string& what_,Exception *nested_)
396  : Warning(what_,nested_)
397{
398}
399
400Magick::WarningBlob::~WarningBlob() throw()
401{
402}
403
404Magick::WarningCache::WarningCache(const std::string& what_)
405  : Warning(what_)
406{
407}
408
409Magick::WarningCache::WarningCache(const std::string& what_,Exception *nested_)
410  : Warning(what_,nested_)
411{
412}
413
414Magick::WarningCache::~WarningCache() throw()
415{
416}
417
418Magick::WarningCoder::WarningCoder(const std::string& what_)
419  : Warning(what_)
420{
421}
422
423Magick::WarningCoder::WarningCoder(const std::string& what_,Exception *nested_)
424  : Warning(what_,nested_)
425{
426}
427
428Magick::WarningCoder::~WarningCoder() throw()
429{
430}
431
432Magick::WarningConfigure::WarningConfigure(const std::string& what_)
433  : Warning(what_)
434{
435}
436
437Magick::WarningConfigure::WarningConfigure(const std::string& what_,
438  Exception *nested_)
439  : Warning(what_,nested_)
440{
441}
442
443Magick::WarningConfigure::~WarningConfigure() throw()
444{
445}
446
447Magick::WarningCorruptImage::WarningCorruptImage(const std::string& what_)
448  : Warning(what_)
449{
450}
451
452Magick::WarningCorruptImage::WarningCorruptImage(const std::string& what_,
453  Exception *nested_)
454  : Warning(what_,nested_)
455{
456}
457
458Magick::WarningCorruptImage::~WarningCorruptImage() throw()
459{
460}
461
462Magick::WarningDelegate::WarningDelegate(const std::string& what_)
463  : Warning(what_)
464{
465}
466
467Magick::WarningDelegate::WarningDelegate(const std::string& what_,
468  Exception *nested_)
469  : Warning(what_,nested_)
470{
471}
472
473Magick::WarningDelegate::~WarningDelegate() throw()
474{
475}
476
477Magick::WarningDraw::WarningDraw(const std::string& what_)
478  : Warning(what_)
479{
480}
481
482Magick::WarningDraw::WarningDraw(const std::string& what_,Exception *nested_)
483  : Warning(what_,nested_)
484{
485}
486
487Magick::WarningDraw::~WarningDraw() throw()
488{
489}
490
491Magick::WarningFileOpen::WarningFileOpen(const std::string& what_)
492  : Warning(what_)
493{
494}
495
496Magick::WarningFileOpen::WarningFileOpen(const std::string& what_,
497  Exception *nested_)
498  : Warning(what_,nested_)
499{
500}
501
502Magick::WarningFileOpen::~WarningFileOpen() throw()
503{
504}
505
506Magick::WarningImage::WarningImage(const std::string& what_)
507  : Warning(what_)
508{
509}
510
511Magick::WarningImage::WarningImage(const std::string& what_,Exception *nested_)
512  : Warning(what_,nested_)
513{
514}
515
516Magick::WarningImage::~WarningImage() throw()
517{
518}
519
520Magick::WarningMissingDelegate::WarningMissingDelegate(
521  const std::string& what_)
522  : Warning(what_)
523{
524}
525
526Magick::WarningMissingDelegate::WarningMissingDelegate(
527  const std::string& what_,Exception *nested_)
528  : Warning(what_,nested_)
529{
530}
531
532Magick::WarningMissingDelegate::~WarningMissingDelegate() throw()
533{
534}
535
536Magick::WarningModule::WarningModule(const std::string& what_)
537  : Warning(what_)
538{
539}
540
541Magick::WarningModule::WarningModule(const std::string& what_,
542  Exception *nested_)
543  : Warning(what_,nested_)
544{
545}
546
547
548Magick::WarningModule::~WarningModule() throw()
549{
550}
551
552Magick::WarningMonitor::WarningMonitor(const std::string& what_)
553  : Warning(what_)
554{
555}
556
557Magick::WarningMonitor::WarningMonitor(const std::string& what_,
558  Exception *nested_)
559  : Warning(what_,nested_)
560{
561}
562
563Magick::WarningMonitor::~WarningMonitor() throw()
564{
565}
566
567Magick::WarningOption::WarningOption(const std::string& what_)
568  : Warning(what_)
569{
570}
571
572Magick::WarningOption::WarningOption(const std::string& what_,
573  Exception *nested_)
574  : Warning(what_,nested_)
575{
576}
577
578Magick::WarningOption::~WarningOption() throw()
579{
580}
581
582Magick::WarningRegistry::WarningRegistry(const std::string& what_)
583  : Warning(what_)
584{
585}
586
587Magick::WarningRegistry::WarningRegistry(const std::string& what_,
588  Exception *nested_)
589  : Warning(what_,nested_)
590{
591}
592
593Magick::WarningRegistry::~WarningRegistry() throw()
594{
595}
596
597Magick::WarningPolicy::WarningPolicy(const std::string& what_)
598  : Warning(what_)
599{
600}
601
602Magick::WarningPolicy::WarningPolicy(const std::string& what_,
603  Exception *nested_)
604  : Warning(what_,nested_)
605{
606}
607
608Magick::WarningPolicy::~WarningPolicy() throw()
609{
610}
611
612Magick::WarningResourceLimit::WarningResourceLimit(const std::string& what_)
613  : Warning(what_)
614{
615}
616
617Magick::WarningResourceLimit::WarningResourceLimit(const std::string& what_,
618  Exception *nested_)
619  : Warning(what_,nested_)
620{
621}
622
623Magick::WarningResourceLimit::~WarningResourceLimit() throw()
624{
625}
626
627Magick::WarningStream::WarningStream(const std::string& what_)
628  : Warning(what_)
629{
630}
631
632Magick::WarningStream::WarningStream(const std::string& what_,
633  Exception *nested_)
634  : Warning(what_,nested_)
635{
636}
637
638Magick::WarningStream::~WarningStream() throw()
639{
640}
641
642Magick::WarningType::WarningType(const std::string& what_)
643  : Warning(what_)
644{
645}
646
647Magick::WarningType::WarningType(const std::string& what_,Exception *nested_)
648  : Warning(what_,nested_)
649{
650}
651
652Magick::WarningType::~WarningType() throw()
653{
654}
655
656Magick::WarningUndefined::WarningUndefined(const std::string& what_)
657  : Warning(what_)
658{
659}
660
661Magick::WarningUndefined::WarningUndefined(const std::string& what_,
662  Exception *nested_)
663  : Warning(what_,nested_)
664{
665}
666
667Magick::WarningUndefined::~WarningUndefined() throw()
668{
669}
670
671Magick::WarningXServer::WarningXServer(const std::string& what_)
672  : Warning(what_)
673{
674}
675
676Magick::WarningXServer::WarningXServer(const std::string& what_,
677  Exception *nested_)
678  : Warning(what_,nested_)
679{
680}
681
682Magick::WarningXServer::~WarningXServer() throw()
683{
684}
685
686std::string Magick::formatExceptionMessage(const MagickCore::ExceptionInfo *exception_)
687{
688  // Format error message ImageMagick-style
689  std::string message=GetClientName();
690  if (exception_->reason != (char *) NULL)
691    {
692      message+=std::string(": ");
693      message+=std::string(exception_->reason);
694    }
695
696  if (exception_->description != (char *) NULL)
697    message += " (" + std::string(exception_->description) + ")";
698  return(message);
699}
700
701Magick::Exception* Magick::createException(const MagickCore::ExceptionInfo *exception_)
702{
703  std::string message=formatExceptionMessage(exception_);
704  switch (exception_->severity)
705  {
706    case MagickCore::BlobError:
707    case MagickCore::BlobFatalError:
708      return new ErrorBlob(message);
709    case MagickCore::BlobWarning:
710      return new WarningBlob(message);
711    case MagickCore::CacheError:
712    case MagickCore::CacheFatalError:
713      return new ErrorCache(message);
714    case MagickCore::CacheWarning:
715      return new WarningCache(message);
716    case MagickCore::CoderError:
717    case MagickCore::CoderFatalError:
718      return new ErrorCoder(message);
719    case MagickCore::CoderWarning:
720      return new WarningCoder(message);
721    case MagickCore::ConfigureError:
722    case MagickCore::ConfigureFatalError:
723      return new ErrorConfigure(message);
724    case MagickCore::ConfigureWarning:
725      return new WarningConfigure(message);
726    case MagickCore::CorruptImageError:
727    case MagickCore::CorruptImageFatalError:
728      return new ErrorCorruptImage(message);
729    case MagickCore::CorruptImageWarning:
730      return new WarningCorruptImage(message);
731    case MagickCore::DelegateError:
732    case MagickCore::DelegateFatalError:
733      return new ErrorDelegate(message);
734    case MagickCore::DelegateWarning:
735      return new WarningDelegate(message);
736    case MagickCore::DrawError:
737    case MagickCore::DrawFatalError:
738      return new ErrorDraw(message);
739    case MagickCore::DrawWarning:
740      return new WarningDraw(message);
741    case MagickCore::FileOpenError:
742    case MagickCore::FileOpenFatalError:
743      return new ErrorFileOpen(message);
744    case MagickCore::FileOpenWarning:
745      return new WarningFileOpen(message);
746    case MagickCore::ImageError:
747    case MagickCore::ImageFatalError:
748      return new ErrorImage(message);
749    case MagickCore::ImageWarning:
750      return new WarningImage(message);
751    case MagickCore::MissingDelegateError:
752    case MagickCore::MissingDelegateFatalError:
753      return new ErrorMissingDelegate(message);
754    case MagickCore::MissingDelegateWarning:
755      return new WarningMissingDelegate(message);
756    case MagickCore::ModuleError:
757    case MagickCore::ModuleFatalError:
758      return new ErrorModule(message);
759    case MagickCore::ModuleWarning:
760      return new WarningModule(message);
761    case MagickCore::MonitorError:
762    case MagickCore::MonitorFatalError:
763      return new ErrorMonitor(message);
764    case MagickCore::MonitorWarning:
765      return new WarningMonitor(message);
766    case MagickCore::OptionError:
767    case MagickCore::OptionFatalError:
768      return new ErrorOption(message);
769    case MagickCore::OptionWarning:
770      return new WarningOption(message);
771    case MagickCore::PolicyWarning:
772      return new WarningPolicy(message);
773    case MagickCore::PolicyError:
774    case MagickCore::PolicyFatalError:
775      return new ErrorPolicy(message);
776    case MagickCore::RegistryError:
777    case MagickCore::RegistryFatalError:
778      return new ErrorRegistry(message);
779    case MagickCore::RegistryWarning:
780      return new WarningRegistry(message);
781    case MagickCore::ResourceLimitError:
782    case MagickCore::ResourceLimitFatalError:
783      return new ErrorResourceLimit(message);
784    case MagickCore::ResourceLimitWarning:
785      return new WarningResourceLimit(message);
786    case MagickCore::StreamError:
787    case MagickCore::StreamFatalError:
788      return new ErrorStream(message);
789    case MagickCore::StreamWarning:
790      return new WarningStream(message);
791    case MagickCore::TypeError:
792    case MagickCore::TypeFatalError:
793      return new ErrorType(message);
794    case MagickCore::TypeWarning:
795      return new WarningType(message);
796    case MagickCore::UndefinedException:
797    default:
798      return new ErrorUndefined(message);
799    case MagickCore::XServerError:
800    case MagickCore::XServerFatalError:
801      return new ErrorXServer(message);
802    case MagickCore::XServerWarning:
803      return new WarningXServer(message);
804    }
805}
806
807MagickPPExport void Magick::throwExceptionExplicit(
808  const MagickCore::ExceptionType severity_,const char* reason_,
809  const char* description_)
810{
811  // Just return if there is no reported error
812  if (severity_ == MagickCore::UndefinedException)
813    return;
814
815  GetPPException;
816  ThrowException(exceptionInfo,severity_,reason_,description_);
817  ThrowPPException(false);
818}
819
820MagickPPExport void Magick::throwException(ExceptionInfo *exception_,
821  const bool quiet_)
822{
823  const ExceptionInfo
824    *p;
825
826  Exception
827    *nestedException,
828    *q;
829
830  MagickCore::ExceptionType
831    severity;
832
833  size_t
834    index;
835
836  std::string
837    message;
838
839  // Just return if there is no reported error
840  if (exception_->severity == MagickCore::UndefinedException)
841    return;
842
843  message=formatExceptionMessage(exception_);
844  nestedException=(Exception *) NULL;
845  LockSemaphoreInfo(exception_->semaphore);
846  if (exception_->exceptions != (void *) NULL)
847    {
848      index=GetNumberOfElementsInLinkedList((LinkedListInfo *)
849        exception_->exceptions);
850      while(index > 0)
851      {
852        p=(const ExceptionInfo *) GetValueFromLinkedList((LinkedListInfo *)
853          exception_->exceptions,--index);
854        if ((p->severity != exception_->severity) || (LocaleCompare(p->reason,
855            exception_->reason) != 0) || (LocaleCompare(p->description,
856            exception_->description) != 0))
857          {
858            if (nestedException == (Exception *) NULL)
859              nestedException=createException(p);
860            else
861              {
862                q=createException(p);
863                nestedException->nested(q);
864                nestedException=q;
865              }
866          }
867      }
868    }
869  severity=exception_->severity;
870  UnlockSemaphoreInfo(exception_->semaphore);
871
872  if ((quiet_) && (severity < MagickCore::ErrorException))
873    {
874      delete nestedException;
875      return;
876    }
877
878  DestroyExceptionInfo(exception_);
879
880  switch (severity)
881  {
882    case MagickCore::BlobError:
883    case MagickCore::BlobFatalError:
884      throw ErrorBlob(message,nestedException);
885    case MagickCore::BlobWarning:
886      throw WarningBlob(message,nestedException);
887    case MagickCore::CacheError:
888    case MagickCore::CacheFatalError:
889      throw ErrorCache(message,nestedException);
890    case MagickCore::CacheWarning:
891      throw WarningCache(message,nestedException);
892    case MagickCore::CoderError:
893    case MagickCore::CoderFatalError:
894      throw ErrorCoder(message,nestedException);
895    case MagickCore::CoderWarning:
896      throw WarningCoder(message,nestedException);
897    case MagickCore::ConfigureError:
898    case MagickCore::ConfigureFatalError:
899      throw ErrorConfigure(message,nestedException);
900    case MagickCore::ConfigureWarning:
901      throw WarningConfigure(message,nestedException);
902    case MagickCore::CorruptImageError:
903    case MagickCore::CorruptImageFatalError:
904      throw ErrorCorruptImage(message,nestedException);
905    case MagickCore::CorruptImageWarning:
906      throw WarningCorruptImage(message,nestedException);
907    case MagickCore::DelegateError:
908    case MagickCore::DelegateFatalError:
909      throw ErrorDelegate(message,nestedException);
910    case MagickCore::DelegateWarning:
911      throw WarningDelegate(message,nestedException);
912    case MagickCore::DrawError:
913    case MagickCore::DrawFatalError:
914      throw ErrorDraw(message,nestedException);
915    case MagickCore::DrawWarning:
916      throw WarningDraw(message,nestedException);
917    case MagickCore::FileOpenError:
918    case MagickCore::FileOpenFatalError:
919      throw ErrorFileOpen(message,nestedException);
920    case MagickCore::FileOpenWarning:
921      throw WarningFileOpen(message,nestedException);
922    case MagickCore::ImageError:
923    case MagickCore::ImageFatalError:
924      throw ErrorImage(message,nestedException);
925    case MagickCore::ImageWarning:
926      throw WarningImage(message,nestedException);
927    case MagickCore::MissingDelegateError:
928    case MagickCore::MissingDelegateFatalError:
929      throw ErrorMissingDelegate(message,nestedException);
930    case MagickCore::MissingDelegateWarning:
931      throw WarningMissingDelegate(message,nestedException);
932    case MagickCore::ModuleError:
933    case MagickCore::ModuleFatalError:
934      throw ErrorModule(message,nestedException);
935    case MagickCore::ModuleWarning:
936      throw WarningModule(message,nestedException);
937    case MagickCore::MonitorError:
938    case MagickCore::MonitorFatalError:
939      throw ErrorMonitor(message,nestedException);
940    case MagickCore::MonitorWarning:
941      throw WarningMonitor(message,nestedException);
942    case MagickCore::OptionError:
943    case MagickCore::OptionFatalError:
944      throw ErrorOption(message,nestedException);
945    case MagickCore::OptionWarning:
946      throw WarningOption(message,nestedException);
947    case MagickCore::PolicyWarning:
948      throw WarningPolicy(message,nestedException);
949    case MagickCore::PolicyError:
950    case MagickCore::PolicyFatalError:
951      throw ErrorPolicy(message,nestedException);
952    case MagickCore::RegistryError:
953    case MagickCore::RegistryFatalError:
954      throw ErrorRegistry(message,nestedException);
955    case MagickCore::RegistryWarning:
956      throw WarningRegistry(message,nestedException);
957    case MagickCore::ResourceLimitError:
958    case MagickCore::ResourceLimitFatalError:
959      throw ErrorResourceLimit(message,nestedException);
960    case MagickCore::ResourceLimitWarning:
961      throw WarningResourceLimit(message,nestedException);
962    case MagickCore::StreamError:
963    case MagickCore::StreamFatalError:
964      throw ErrorStream(message,nestedException);
965    case MagickCore::StreamWarning:
966      throw WarningStream(message,nestedException);
967    case MagickCore::TypeError:
968    case MagickCore::TypeFatalError:
969      throw ErrorType(message,nestedException);
970    case MagickCore::TypeWarning:
971      throw WarningType(message,nestedException);
972    case MagickCore::UndefinedException:
973    default:
974      throw ErrorUndefined(message,nestedException);
975    case MagickCore::XServerError:
976    case MagickCore::XServerFatalError:
977      throw ErrorXServer(message,nestedException);
978    case MagickCore::XServerWarning:
979      throw WarningXServer(message,nestedException);
980    }
981}