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