1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2014 Brazil |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License version 2.1 as published by the Free Software Foundation. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with this library; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ |
18 | |
19 | #include "../grn_ctx_impl.h" |
20 | |
21 | #ifdef GRN_WITH_MRUBY |
22 | #include <mruby.h> |
23 | |
24 | #include "../grn_mrb.h" |
25 | #include "mrb_error.h" |
26 | |
27 | void |
28 | grn_mrb_error_init(grn_ctx *ctx) |
29 | { |
30 | grn_mrb_data *data = &(ctx->impl->mrb); |
31 | mrb_state *mrb = data->state; |
32 | struct RClass *module = data->module; |
33 | struct RClass *error_class; |
34 | struct RClass *groonga_error_class; |
35 | |
36 | error_class = mrb_define_class_under(mrb, module, "Error" , |
37 | mrb->eStandardError_class); |
38 | groonga_error_class = mrb_define_class_under(mrb, module, "GroongaError" , |
39 | error_class); |
40 | |
41 | mrb_define_class_under(mrb, module, "EndOfData" , |
42 | groonga_error_class); |
43 | mrb_define_class_under(mrb, module, "UnknownError" , |
44 | groonga_error_class); |
45 | mrb_define_class_under(mrb, module, "OperationNotPermitted" , |
46 | groonga_error_class); |
47 | mrb_define_class_under(mrb, module, "NoSuchFileOrDirectory" , |
48 | groonga_error_class); |
49 | mrb_define_class_under(mrb, module, "NoSuchProcess" , |
50 | groonga_error_class); |
51 | mrb_define_class_under(mrb, module, "InterruptedFunctionCall" , |
52 | groonga_error_class); |
53 | mrb_define_class_under(mrb, module, "InputOutputError" , |
54 | groonga_error_class); |
55 | mrb_define_class_under(mrb, module, "NoSuchDeviceOrAddress" , |
56 | groonga_error_class); |
57 | mrb_define_class_under(mrb, module, "ArgListTooLong" , |
58 | groonga_error_class); |
59 | mrb_define_class_under(mrb, module, "ExecFormatError" , |
60 | groonga_error_class); |
61 | mrb_define_class_under(mrb, module, "BadFileDescriptor" , |
62 | groonga_error_class); |
63 | mrb_define_class_under(mrb, module, "NoChildProcesses" , |
64 | groonga_error_class); |
65 | mrb_define_class_under(mrb, module, "ResourceTemporarilyUnavailable" , |
66 | groonga_error_class); |
67 | mrb_define_class_under(mrb, module, "NotEnoughSpace" , |
68 | groonga_error_class); |
69 | mrb_define_class_under(mrb, module, "PermissionDenied" , |
70 | groonga_error_class); |
71 | mrb_define_class_under(mrb, module, "BadAddress" , |
72 | groonga_error_class); |
73 | mrb_define_class_under(mrb, module, "ResourceBusy" , |
74 | groonga_error_class); |
75 | mrb_define_class_under(mrb, module, "FileExists" , |
76 | groonga_error_class); |
77 | mrb_define_class_under(mrb, module, "ImproperLink" , |
78 | groonga_error_class); |
79 | mrb_define_class_under(mrb, module, "NoSuchDevice" , |
80 | groonga_error_class); |
81 | mrb_define_class_under(mrb, module, "NotDirectory" , |
82 | groonga_error_class); |
83 | mrb_define_class_under(mrb, module, "IsDirectory" , |
84 | groonga_error_class); |
85 | mrb_define_class_under(mrb, module, "InvalidArgument" , |
86 | groonga_error_class); |
87 | mrb_define_class_under(mrb, module, "TooManyOpenFilesInSystem" , |
88 | groonga_error_class); |
89 | mrb_define_class_under(mrb, module, "TooManyOpenFiles" , |
90 | groonga_error_class); |
91 | mrb_define_class_under(mrb, module, "InappropriateIOControlOperation" , |
92 | groonga_error_class); |
93 | mrb_define_class_under(mrb, module, "FileTooLarge" , |
94 | groonga_error_class); |
95 | mrb_define_class_under(mrb, module, "NoSpaceLeftOnDevice" , |
96 | groonga_error_class); |
97 | mrb_define_class_under(mrb, module, "InvalidSeek" , |
98 | groonga_error_class); |
99 | mrb_define_class_under(mrb, module, "ReadOnlyFileSystem" , |
100 | groonga_error_class); |
101 | mrb_define_class_under(mrb, module, "TooManyLinks" , |
102 | groonga_error_class); |
103 | mrb_define_class_under(mrb, module, "BrokenPipe" , |
104 | groonga_error_class); |
105 | mrb_define_class_under(mrb, module, "DomainError" , |
106 | groonga_error_class); |
107 | mrb_define_class_under(mrb, module, "ResultTooLarge" , |
108 | groonga_error_class); |
109 | mrb_define_class_under(mrb, module, "ResourceDeadlockAvoided" , |
110 | groonga_error_class); |
111 | mrb_define_class_under(mrb, module, "NoMemoryAvailable" , |
112 | groonga_error_class); |
113 | mrb_define_class_under(mrb, module, "FilenameTooLong" , |
114 | groonga_error_class); |
115 | mrb_define_class_under(mrb, module, "NoLocksAvailable" , |
116 | groonga_error_class); |
117 | mrb_define_class_under(mrb, module, "FunctionNotImplemented" , |
118 | groonga_error_class); |
119 | mrb_define_class_under(mrb, module, "DirectoryNotEmpty" , |
120 | groonga_error_class); |
121 | mrb_define_class_under(mrb, module, "IllegalByteSequence" , |
122 | groonga_error_class); |
123 | mrb_define_class_under(mrb, module, "SocketNotInitialized" , |
124 | groonga_error_class); |
125 | mrb_define_class_under(mrb, module, "OperationWouldBlock" , |
126 | groonga_error_class); |
127 | mrb_define_class_under(mrb, module, "AddressIsNotAvailable" , |
128 | groonga_error_class); |
129 | mrb_define_class_under(mrb, module, "NetworkIsDown" , |
130 | groonga_error_class); |
131 | mrb_define_class_under(mrb, module, "NoBuffer" , |
132 | groonga_error_class); |
133 | mrb_define_class_under(mrb, module, "SocketIsAlreadyConnected" , |
134 | groonga_error_class); |
135 | mrb_define_class_under(mrb, module, "SocketIsNotConnected" , |
136 | groonga_error_class); |
137 | mrb_define_class_under(mrb, module, "SocketIsAlreadyShutdowned" , |
138 | groonga_error_class); |
139 | mrb_define_class_under(mrb, module, "OperationTimeout" , |
140 | groonga_error_class); |
141 | mrb_define_class_under(mrb, module, "ConnectionRefused" , |
142 | groonga_error_class); |
143 | mrb_define_class_under(mrb, module, "RangeError" , |
144 | groonga_error_class); |
145 | mrb_define_class_under(mrb, module, "TokenizerError" , |
146 | groonga_error_class); |
147 | mrb_define_class_under(mrb, module, "FileCorrupt" , |
148 | groonga_error_class); |
149 | mrb_define_class_under(mrb, module, "InvalidFormat" , |
150 | groonga_error_class); |
151 | mrb_define_class_under(mrb, module, "ObjectCorrupt" , |
152 | groonga_error_class); |
153 | mrb_define_class_under(mrb, module, "TooManySymbolicLinks" , |
154 | groonga_error_class); |
155 | mrb_define_class_under(mrb, module, "NotSocket" , |
156 | groonga_error_class); |
157 | mrb_define_class_under(mrb, module, "OperationNotSupported" , |
158 | groonga_error_class); |
159 | mrb_define_class_under(mrb, module, "AddressIsInUse" , |
160 | groonga_error_class); |
161 | mrb_define_class_under(mrb, module, "ZlibError" , |
162 | groonga_error_class); |
163 | mrb_define_class_under(mrb, module, "LZ4Error" , |
164 | groonga_error_class); |
165 | mrb_define_class_under(mrb, module, "StackOverFlow" , |
166 | groonga_error_class); |
167 | mrb_define_class_under(mrb, module, "SyntaxError" , |
168 | groonga_error_class); |
169 | mrb_define_class_under(mrb, module, "RetryMax" , |
170 | groonga_error_class); |
171 | mrb_define_class_under(mrb, module, "IncompatibleFileFormat" , |
172 | groonga_error_class); |
173 | mrb_define_class_under(mrb, module, "UpdateNotAllowed" , |
174 | groonga_error_class); |
175 | mrb_define_class_under(mrb, module, "TooSmallOffset" , |
176 | groonga_error_class); |
177 | mrb_define_class_under(mrb, module, "TooLargeOffset" , |
178 | groonga_error_class); |
179 | mrb_define_class_under(mrb, module, "TooSmallLimit" , |
180 | groonga_error_class); |
181 | mrb_define_class_under(mrb, module, "CASError" , |
182 | groonga_error_class); |
183 | mrb_define_class_under(mrb, module, "UnsupportedCommandVersion" , |
184 | groonga_error_class); |
185 | mrb_define_class_under(mrb, module, "NormalizerError" , |
186 | groonga_error_class); |
187 | mrb_define_class_under(mrb, module, "TokenFilterError" , |
188 | groonga_error_class); |
189 | mrb_define_class_under(mrb, module, "CommandError" , |
190 | groonga_error_class); |
191 | mrb_define_class_under(mrb, module, "PluginError" , |
192 | groonga_error_class); |
193 | mrb_define_class_under(mrb, module, "ScorerError" , |
194 | groonga_error_class); |
195 | mrb_define_class_under(mrb, module, "Cancel" , |
196 | groonga_error_class); |
197 | mrb_define_class_under(mrb, module, "WindowFunctionError" , |
198 | groonga_error_class); |
199 | mrb_define_class_under(mrb, module, "ZstdError" , |
200 | groonga_error_class); |
201 | } |
202 | #endif |
203 | |