MagickCore 6.9.13
Loading...
Searching...
No Matches
exception.h
1/*
2 Copyright 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License. You may
6 obtain a copy of the License at
7
8 https://imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore exception methods.
17*/
18#ifndef MAGICKCORE_EXCEPTION_H
19#define MAGICKCORE_EXCEPTION_H
20
21#include <stdarg.h>
22#include "magick/semaphore.h"
23
24#if defined(__cplusplus) || defined(c_plusplus)
25extern "C" {
26#endif
27
28typedef enum
29{
30 UndefinedException,
31 WarningException = 300,
32 ResourceLimitWarning = 300,
33 TypeWarning = 305,
34 OptionWarning = 310,
35 DelegateWarning = 315,
36 MissingDelegateWarning = 320,
37 CorruptImageWarning = 325,
38 FileOpenWarning = 330,
39 BlobWarning = 335,
40 StreamWarning = 340,
41 CacheWarning = 345,
42 CoderWarning = 350,
43 FilterWarning = 352,
44 ModuleWarning = 355,
45 DrawWarning = 360,
46 ImageWarning = 365,
47 WandWarning = 370,
48 RandomWarning = 375,
49 XServerWarning = 380,
50 MonitorWarning = 385,
51 RegistryWarning = 390,
52 ConfigureWarning = 395,
53 PolicyWarning = 399,
54 ErrorException = 400,
55 ResourceLimitError = 400,
56 TypeError = 405,
57 OptionError = 410,
58 DelegateError = 415,
59 MissingDelegateError = 420,
60 CorruptImageError = 425,
61 FileOpenError = 430,
62 BlobError = 435,
63 StreamError = 440,
64 CacheError = 445,
65 CoderError = 450,
66 FilterError = 452,
67 ModuleError = 455,
68 DrawError = 460,
69 ImageError = 465,
70 WandError = 470,
71 RandomError = 475,
72 XServerError = 480,
73 MonitorError = 485,
74 RegistryError = 490,
75 ConfigureError = 495,
76 PolicyError = 499,
77 FatalErrorException = 700,
78 ResourceLimitFatalError = 700,
79 TypeFatalError = 705,
80 OptionFatalError = 710,
81 DelegateFatalError = 715,
82 MissingDelegateFatalError = 720,
83 CorruptImageFatalError = 725,
84 FileOpenFatalError = 730,
85 BlobFatalError = 735,
86 StreamFatalError = 740,
87 CacheFatalError = 745,
88 CoderFatalError = 750,
89 FilterFatalError = 752,
90 ModuleFatalError = 755,
91 DrawFatalError = 760,
92 ImageFatalError = 765,
93 WandFatalError = 770,
94 RandomFatalError = 775,
95 XServerFatalError = 780,
96 MonitorFatalError = 785,
97 RegistryFatalError = 790,
98 ConfigureFatalError = 795,
99 PolicyFatalError = 799
100} ExceptionType;
101
103{
104 ExceptionType
105 severity;
106
107 int
108 error_number;
109
110 char
111 *reason,
112 *description;
113
114 void
115 *exceptions;
116
117 MagickBooleanType
118 relinquish;
119
121 *semaphore;
122
123 size_t
124 signature;
125};
126
127typedef void
128 (*ErrorHandler)(const ExceptionType,const char *,const char *);
129
130typedef void
131 (*FatalErrorHandler)(const ExceptionType,const char *,const char *)
132 magick_attribute((__noreturn__));
133
134typedef void
135 (*WarningHandler)(const ExceptionType,const char *,const char *);
136
137extern MagickExport char
138 *GetExceptionMessage(const int);
139
140extern MagickExport const char
141 *GetLocaleExceptionMessage(const ExceptionType,const char *);
142
143extern MagickExport ErrorHandler
144 SetErrorHandler(ErrorHandler);
145
146extern MagickExport ExceptionInfo
147 *AcquireExceptionInfo(void),
148 *CloneExceptionInfo(ExceptionInfo *),
149 *DestroyExceptionInfo(ExceptionInfo *);
150
151extern MagickExport FatalErrorHandler
152 SetFatalErrorHandler(FatalErrorHandler);
153
154extern MagickExport MagickBooleanType
155 ThrowException(ExceptionInfo *,const ExceptionType,const char *,
156 const char *),
157 ThrowMagickException(ExceptionInfo *,const char *,const char *,const size_t,
158 const ExceptionType,const char *,const char *,...)
159 magick_attribute((__format__ (__printf__,7,8))),
160 ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
161 const size_t,const ExceptionType,const char *,const char *,va_list)
162 magick_attribute((__format__ (__printf__,7,0)));
163
164extern MagickExport void
165 CatchException(ExceptionInfo *),
166 ClearMagickException(ExceptionInfo *),
167 InheritException(ExceptionInfo *,const ExceptionInfo *),
168 MagickError(const ExceptionType,const char *,const char *),
169 MagickFatalError(const ExceptionType,const char *,const char *)
170 magick_attribute((__noreturn__)),
171 MagickWarning(const ExceptionType,const char *,const char *);
172
173extern MagickExport WarningHandler
174 SetWarningHandler(WarningHandler);
175
176#if defined(__cplusplus) || defined(c_plusplus)
177}
178#endif
179
180#endif