mongory 0.7.1 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/README.md +34 -0
  4. data/Rakefile +28 -9
  5. data/ext/mongory_ext/mongory_ext.c +77 -29
  6. data/lib/mongory/matchers/in_matcher.rb +2 -2
  7. data/lib/mongory/matchers/nin_matcher.rb +2 -2
  8. data/lib/mongory/version.rb +1 -1
  9. data/lib/mongory.rb +4 -2
  10. metadata +7 -62
  11. data/ext/mongory_ext/mongory-core/LICENSE +0 -3
  12. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/array.h +0 -105
  13. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/config.h +0 -206
  14. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/error.h +0 -82
  15. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/memory_pool.h +0 -95
  16. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/table.h +0 -108
  17. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/value.h +0 -175
  18. data/ext/mongory_ext/mongory-core/include/mongory-core/matchers/matcher.h +0 -76
  19. data/ext/mongory_ext/mongory-core/include/mongory-core.h +0 -12
  20. data/ext/mongory_ext/mongory-core/src/foundations/array.c +0 -246
  21. data/ext/mongory_ext/mongory-core/src/foundations/array_private.h +0 -18
  22. data/ext/mongory_ext/mongory-core/src/foundations/config.c +0 -406
  23. data/ext/mongory_ext/mongory-core/src/foundations/config_private.h +0 -30
  24. data/ext/mongory_ext/mongory-core/src/foundations/error.c +0 -30
  25. data/ext/mongory_ext/mongory-core/src/foundations/memory_pool.c +0 -298
  26. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.c +0 -65
  27. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.h +0 -49
  28. data/ext/mongory_ext/mongory-core/src/foundations/table.c +0 -458
  29. data/ext/mongory_ext/mongory-core/src/foundations/value.c +0 -459
  30. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.c +0 -309
  31. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.h +0 -47
  32. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.c +0 -161
  33. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.h +0 -115
  34. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.c +0 -210
  35. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.h +0 -83
  36. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.c +0 -539
  37. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.h +0 -125
  38. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.c +0 -144
  39. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.h +0 -48
  40. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.c +0 -121
  41. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.h +0 -46
  42. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.c +0 -199
  43. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.h +0 -46
  44. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.c +0 -334
  45. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.h +0 -97
  46. data/ext/mongory_ext/mongory-core/src/matchers/matcher.c +0 -198
  47. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.c +0 -107
  48. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.h +0 -50
  49. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.c +0 -55
  50. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.h +0 -23
  51. data/mongory.gemspec +0 -46
@@ -1,406 +0,0 @@
1
- /**
2
- * @file config.c
3
- * @brief Implements global configuration and initialization for the Mongory
4
- * library.
5
- *
6
- * This file manages the lifecycle of global resources such as the internal
7
- * memory pool, regex adapter, matcher registration table, and value converters.
8
- * It provides the `mongory_init` and `mongory_cleanup` functions, as well as
9
- * setters for customizable components and a string copy utility.
10
- */
11
- #include "mongory-core/foundations/config.h"
12
- #include "../matchers/base_matcher.h" // For mongory_matcher_build_func
13
- #include "../matchers/compare_matcher.h" // For specific matcher constructors
14
- #include "../matchers/composite_matcher.h" // For specific matcher constructors
15
- #include "../matchers/existance_matcher.h" // For specific matcher constructors
16
- #include "../matchers/inclusion_matcher.h" // For specific matcher constructors
17
- #include "../matchers/literal_matcher.h" // For specific matcher constructors
18
- #include "../matchers/external_matcher.h" // For specific matcher constructors
19
- #include "config_private.h" // For mongory_regex_adapter, mongory_value_converter, etc.
20
- #include "mongory-core/foundations/memory_pool.h"
21
- #include "mongory-core/foundations/table.h"
22
- #include "mongory-core/foundations/value.h"
23
- #include <stdarg.h> // For va_list, va_start, va_end, vsnprintf
24
- #include <stdio.h> // For snprintf
25
- #include <string.h> // For strlen, strcpy
26
-
27
- // Global internal memory pool for the library.
28
- mongory_memory_pool *mongory_internal_pool = NULL;
29
- // Global adapter for regex operations.
30
- mongory_regex_adapter *mongory_internal_regex_adapter = NULL;
31
- // Global table mapping matcher names (e.g., "$eq") to their build functions.
32
- mongory_table *mongory_matcher_mapping = NULL;
33
- // Global converter for handling external data types.
34
- mongory_value_converter *mongory_internal_value_converter = NULL;
35
- // Global adapter for custom matchers.
36
- mongory_matcher_custom_adapter *mongory_custom_matcher_adapter = NULL;
37
-
38
- /**
39
- * @brief Initializes the internal memory pool if it hasn't been already.
40
- * This pool is used for allocations by various library components.
41
- */
42
- static inline void mongory_internal_pool_init() {
43
- if (mongory_internal_pool != NULL) {
44
- return; // Already initialized.
45
- }
46
- mongory_internal_pool = mongory_memory_pool_new();
47
- // TODO: Add error handling if mongory_memory_pool_new returns NULL.
48
- }
49
-
50
- /**
51
- * @brief Default regex function that always returns false.
52
- * Used if no custom regex function is set via mongory_regex_func_set.
53
- * @param pool Unused.
54
- * @param pattern Unused.
55
- * @param value Unused.
56
- * @return Always false.
57
- */
58
- static inline bool mongory_regex_default_func(mongory_memory_pool *pool, mongory_value *pattern, mongory_value *value) {
59
- (void)pool; // Mark as unused to prevent compiler warnings.
60
- (void)pattern; // Mark as unused.
61
- (void)value; // Mark as unused.
62
- return false; // Default behavior is no match.
63
- }
64
-
65
- static inline char *mongory_regex_default_stringify_func(mongory_memory_pool *pool, mongory_value *pattern) {
66
- (void)pool; // Mark as unused to prevent compiler warnings.
67
- (void)pattern; // Mark as unused.
68
- return "//"; // Default behavior is no stringification.
69
- }
70
-
71
- /**
72
- * @brief Initializes the internal regex adapter if it hasn't been already.
73
- * Allocates the adapter structure from the internal pool and sets the default
74
- * regex function.
75
- */
76
- static inline void mongory_internal_regex_adapter_init() {
77
- if (mongory_internal_regex_adapter != NULL) {
78
- return; // Already initialized.
79
- }
80
-
81
- // Ensure the internal pool is initialized first.
82
- mongory_internal_pool_init();
83
- if (mongory_internal_pool == NULL) {
84
- // Cannot proceed if pool initialization failed.
85
- return;
86
- }
87
-
88
- mongory_internal_regex_adapter = MG_ALLOC_PTR(mongory_internal_pool, mongory_regex_adapter);
89
- if (mongory_internal_regex_adapter == NULL) {
90
- // TODO: Set error state (e.g., in mongory_internal_pool->error).
91
- return;
92
- }
93
-
94
- mongory_internal_regex_adapter->match_func = mongory_regex_default_func;
95
- mongory_internal_regex_adapter->stringify_func = mongory_regex_default_stringify_func;
96
- }
97
-
98
- /**
99
- * @brief Sets the global regex matching function.
100
- * Initializes the regex adapter if it's not already.
101
- * @param func The custom regex function to use.
102
- */
103
- void mongory_regex_func_set(mongory_regex_func func) {
104
- if (mongory_internal_regex_adapter == NULL) {
105
- mongory_internal_regex_adapter_init();
106
- }
107
- if (mongory_internal_regex_adapter != NULL) {
108
- mongory_internal_regex_adapter->match_func = func;
109
- }
110
- // TODO: What if mongory_internal_regex_adapter is still NULL after init?
111
- // (e.g. pool alloc failed)
112
- }
113
-
114
- /**
115
- * @brief Sets the global regex stringify function.
116
- * Initializes the regex adapter if it's not already.
117
- * @param func The custom regex stringify function to use.
118
- */
119
- void mongory_regex_stringify_func_set(mongory_regex_stringify_func func) {
120
- if (mongory_internal_regex_adapter == NULL) {
121
- mongory_internal_regex_adapter_init();
122
- }
123
- if (mongory_internal_regex_adapter != NULL) {
124
- mongory_internal_regex_adapter->stringify_func = func;
125
- }
126
- }
127
- /**
128
- * @brief Initializes the matcher mapping table if it hasn't been already.
129
- * This table stores registrations of matcher names to their constructor
130
- * functions.
131
- */
132
- static inline void mongory_matcher_mapping_init() {
133
- if (mongory_matcher_mapping != NULL) {
134
- return; // Already initialized.
135
- }
136
-
137
- // Ensure the internal pool is initialized first.
138
- mongory_internal_pool_init();
139
- if (mongory_internal_pool == NULL) {
140
- return; // Cannot proceed if pool initialization failed.
141
- }
142
-
143
- mongory_matcher_mapping = mongory_table_new(mongory_internal_pool);
144
- if (mongory_matcher_mapping == NULL) {
145
- // TODO: Set error state.
146
- return;
147
- }
148
- }
149
-
150
- /**
151
- * @brief Registers a matcher build function with a given name.
152
- * The build function is stored in the global matcher mapping table.
153
- * @param name The name of the matcher (e.g., "$eq", "$in").
154
- * @param build_func A function pointer to the matcher's constructor.
155
- */
156
- void mongory_matcher_register(char *name, mongory_matcher_build_func build_func) {
157
- // Ensure mapping is initialized.
158
- if (mongory_matcher_mapping == NULL) {
159
- mongory_matcher_mapping_init();
160
- if (mongory_matcher_mapping == NULL) {
161
- // TODO: Set error: Cannot register if mapping init failed.
162
- return;
163
- }
164
- }
165
-
166
- // Wrap the function pointer in a mongory_value to store in the table.
167
- mongory_value *value = mongory_value_wrap_ptr(mongory_internal_pool, build_func);
168
- if (value == NULL) {
169
- // TODO: Set error: Failed to wrap pointer.
170
- return;
171
- }
172
-
173
- mongory_matcher_mapping->set(mongory_matcher_mapping, name, value);
174
- // TODO: Check return value of set?
175
- }
176
-
177
- /**
178
- * @brief Retrieves a matcher build function by its name from the global
179
- * mapping.
180
- * @param name The name of the matcher to retrieve.
181
- * @return mongory_matcher_build_func A function pointer to the matcher's
182
- * constructor, or NULL if not found.
183
- */
184
- mongory_matcher_build_func mongory_matcher_build_func_get(char *name) {
185
- if (mongory_matcher_mapping == NULL) {
186
- return NULL; // Mapping not initialized or init failed.
187
- }
188
-
189
- mongory_value *value = mongory_matcher_mapping->get(mongory_matcher_mapping, name);
190
- if (value == NULL || value->type != MONGORY_TYPE_POINTER) {
191
- return NULL; // Not found or not a pointer type as expected.
192
- }
193
-
194
- return (mongory_matcher_build_func)value->data.ptr;
195
- }
196
-
197
- /**
198
- * @brief Initializes the internal value converter if it hasn't been already.
199
- * This converter holds function pointers for custom data type conversions.
200
- */
201
- static inline void mongory_internal_value_converter_init() {
202
- if (mongory_internal_value_converter != NULL) {
203
- return; // Already initialized.
204
- }
205
-
206
- mongory_internal_pool_init();
207
- if (mongory_internal_pool == NULL) {
208
- return; // Cannot proceed if pool init failed.
209
- }
210
-
211
- mongory_internal_value_converter = MG_ALLOC_PTR(mongory_internal_pool, mongory_value_converter);
212
- if (mongory_internal_value_converter == NULL) {
213
- // TODO: Set error state.
214
- return;
215
- }
216
- // Initialize function pointers to NULL or default no-op functions if desired.
217
- mongory_internal_value_converter->deep_convert = NULL;
218
- mongory_internal_value_converter->shallow_convert = NULL;
219
- mongory_internal_value_converter->recover = NULL;
220
- }
221
-
222
- /**
223
- * @brief Sets the function for deep conversion of external values.
224
- * Initializes the value converter if necessary.
225
- * @param deep_convert The deep conversion function.
226
- */
227
- void mongory_value_converter_deep_convert_set(mongory_deep_convert_func deep_convert) {
228
- if (mongory_internal_value_converter == NULL) {
229
- mongory_internal_value_converter_init();
230
- }
231
- if (mongory_internal_value_converter != NULL) {
232
- mongory_internal_value_converter->deep_convert = deep_convert;
233
- }
234
- // TODO: Handle case where converter is still NULL after init.
235
- }
236
-
237
- /**
238
- * @brief Sets the function for shallow conversion of external values.
239
- * Initializes the value converter if necessary.
240
- * @param shallow_convert The shallow conversion function.
241
- */
242
- void mongory_value_converter_shallow_convert_set(mongory_shallow_convert_func shallow_convert) {
243
- if (mongory_internal_value_converter == NULL) {
244
- mongory_internal_value_converter_init();
245
- }
246
- if (mongory_internal_value_converter != NULL) {
247
- mongory_internal_value_converter->shallow_convert = shallow_convert;
248
- }
249
- // TODO: Handle case where converter is still NULL after init.
250
- }
251
-
252
- /**
253
- * @brief Sets the function for recovering external values from mongory_value.
254
- * Initializes the value converter if necessary.
255
- * @param recover The recovery function.
256
- */
257
- void mongory_value_converter_recover_set(mongory_recover_func recover) {
258
- if (mongory_internal_value_converter == NULL) {
259
- mongory_internal_value_converter_init();
260
- }
261
- if (mongory_internal_value_converter != NULL) {
262
- mongory_internal_value_converter->recover = recover;
263
- }
264
- // TODO: Handle case where converter is still NULL after init.
265
- }
266
-
267
- /**
268
- * @brief Initializes the custom matcher adapter if it hasn't been already.
269
- * This adapter holds function pointers for custom matchers.
270
- */
271
- static void mongory_custom_matcher_adapter_init() {
272
- if (mongory_custom_matcher_adapter != NULL) {
273
- return; // Already initialized.
274
- }
275
- mongory_custom_matcher_adapter = MG_ALLOC_PTR(mongory_internal_pool, mongory_matcher_custom_adapter);
276
- if (mongory_custom_matcher_adapter == NULL) {
277
- // TODO: Set error state.
278
- return;
279
- }
280
- mongory_custom_matcher_adapter->build = NULL;
281
- mongory_custom_matcher_adapter->lookup = NULL;
282
- mongory_custom_matcher_adapter->match = NULL;
283
- }
284
-
285
- void mongory_custom_matcher_match_func_set(bool (*match)(void *external_matcher, mongory_value *value)) {
286
- if (mongory_custom_matcher_adapter == NULL) {
287
- mongory_custom_matcher_adapter_init();
288
- }
289
- mongory_custom_matcher_adapter->match = match;
290
- }
291
-
292
- void mongory_custom_matcher_build_func_set(mongory_matcher_custom_context *(*build)(char *key, mongory_value *condition, void *extern_ctx)) {
293
- if (mongory_custom_matcher_adapter == NULL) {
294
- mongory_custom_matcher_adapter_init();
295
- }
296
- mongory_custom_matcher_adapter->build = build;
297
- }
298
-
299
- void mongory_custom_matcher_lookup_func_set(bool (*lookup)(char *key)) {
300
- if (mongory_custom_matcher_adapter == NULL) {
301
- mongory_custom_matcher_adapter_init();
302
- }
303
- mongory_custom_matcher_adapter->lookup = lookup;
304
- }
305
-
306
- /**
307
- * @brief Creates a copy of a string using the specified memory pool.
308
- * @param pool The memory pool to use for allocation.
309
- * @param str The null-terminated string to copy.
310
- * @return A pointer to the newly allocated copy, or NULL if str is NULL or
311
- * allocation fails.
312
- */
313
- char *mongory_string_cpy(mongory_memory_pool *pool, char *str) {
314
- if (str == NULL) {
315
- return NULL;
316
- }
317
-
318
- size_t len = strlen(str);
319
- char *new_str = (char *)MG_ALLOC(pool, len + 1); // +1 for null terminator.
320
- if (new_str == NULL) {
321
- pool->error = &MONGORY_ALLOC_ERROR;
322
- return NULL;
323
- }
324
-
325
- strcpy(new_str, str);
326
- return new_str;
327
- }
328
-
329
- char *mongory_string_cpyf(mongory_memory_pool *pool, char *format, ...) {
330
- va_list args;
331
- va_start(args, format);
332
- int len = vsnprintf(NULL, 0, format, args);
333
- va_end(args);
334
- char *new_str = (char *)MG_ALLOC(pool, len + 1);
335
- if (new_str == NULL) {
336
- pool->error = &MONGORY_ALLOC_ERROR;
337
- return NULL;
338
- }
339
- va_start(args, format);
340
- vsnprintf(new_str, len + 1, format, args);
341
- va_end(args);
342
- new_str[len] = '\0';
343
- return new_str;
344
- }
345
-
346
- /**
347
- * @brief Initializes all core Mongory library components.
348
- * This includes the internal memory pool, regex adapter, matcher mapping table,
349
- * and value converter. It then registers all standard matcher types.
350
- * This function MUST be called before using most other library features.
351
- */
352
- void mongory_init() {
353
- // Initialize all global components. Order can be important if one init
354
- // depends on another (e.g., most depend on the pool).
355
- mongory_internal_pool_init();
356
- mongory_internal_regex_adapter_init();
357
- mongory_matcher_mapping_init();
358
- mongory_internal_value_converter_init();
359
- mongory_custom_matcher_adapter_init();
360
-
361
- // Register all standard matchers.
362
- // Note: These registrations rely on mongory_internal_pool and
363
- // mongory_matcher_mapping being successfully initialized.
364
- // TODO: Add checks to ensure initializations were successful before
365
- // proceeding.
366
- mongory_matcher_register("$in", mongory_matcher_in_new);
367
- mongory_matcher_register("$nin", mongory_matcher_not_in_new);
368
- mongory_matcher_register("$eq", mongory_matcher_equal_new);
369
- mongory_matcher_register("$ne", mongory_matcher_not_equal_new);
370
- mongory_matcher_register("$gt", mongory_matcher_greater_than_new);
371
- mongory_matcher_register("$gte", mongory_matcher_greater_than_or_equal_new);
372
- mongory_matcher_register("$lt", mongory_matcher_less_than_new);
373
- mongory_matcher_register("$lte", mongory_matcher_less_than_or_equal_new);
374
- mongory_matcher_register("$exists", mongory_matcher_exists_new);
375
- mongory_matcher_register("$present", mongory_matcher_present_new);
376
- mongory_matcher_register("$regex", mongory_matcher_regex_new);
377
- mongory_matcher_register("$and", mongory_matcher_and_new);
378
- mongory_matcher_register("$or", mongory_matcher_or_new);
379
- mongory_matcher_register("$elemMatch", mongory_matcher_elem_match_new);
380
- mongory_matcher_register("$every", mongory_matcher_every_new);
381
- mongory_matcher_register("$not", mongory_matcher_not_new);
382
- mongory_matcher_register("$size", mongory_matcher_size_new);
383
- }
384
-
385
- /**
386
- * @brief Cleans up all resources allocated by the Mongory library.
387
- * This primarily involves freeing the internal memory pool, which should, in
388
- * turn, release all memory allocated from it. It also resets global pointers
389
- * to NULL. This should be called when the library is no longer needed to
390
- * prevent memory leaks.
391
- */
392
- void mongory_cleanup() {
393
- if (mongory_internal_pool != NULL) {
394
- // Freeing the pool should handle all allocations made from it,
395
- // including the regex_adapter, matcher_mapping table (and its contents if
396
- // they were allocated from this pool), and value_converter.
397
- mongory_internal_pool->free(mongory_internal_pool);
398
- mongory_internal_pool = NULL;
399
- }
400
-
401
- // Set other global pointers to NULL to indicate they are no longer valid.
402
- // The memory they pointed to should have been managed by the internal pool.
403
- mongory_internal_regex_adapter = NULL;
404
- mongory_matcher_mapping = NULL; // The table itself and its nodes.
405
- mongory_internal_value_converter = NULL;
406
- }
@@ -1,30 +0,0 @@
1
- #ifndef MONGORY_FOUNDATIONS_CONFIG_PRIVATE_H
2
- #define MONGORY_FOUNDATIONS_CONFIG_PRIVATE_H
3
- #include "../matchers/base_matcher.h"
4
- #include "mongory-core/foundations/config.h"
5
- #include "mongory-core/foundations/table.h"
6
- #include "mongory-core/matchers/matcher.h"
7
-
8
- typedef struct mongory_regex_adapter {
9
- mongory_regex_func match_func;
10
- mongory_regex_stringify_func stringify_func;
11
- } mongory_regex_adapter;
12
-
13
- typedef struct mongory_value_converter {
14
- mongory_deep_convert_func deep_convert;
15
- mongory_shallow_convert_func shallow_convert;
16
- mongory_recover_func recover;
17
- } mongory_value_converter;
18
-
19
- extern mongory_memory_pool *mongory_internal_pool;
20
- extern mongory_regex_adapter *mongory_internal_regex_adapter;
21
- extern mongory_table *mongory_matcher_mapping;
22
- extern mongory_value_converter *mongory_internal_value_converter;
23
-
24
- typedef mongory_matcher *(*mongory_matcher_build_func)(mongory_memory_pool *pool,
25
- mongory_value *condition,
26
- void *extern_ctx); // build function
27
- void mongory_matcher_register(char *name, mongory_matcher_build_func build_func);
28
- mongory_matcher_build_func mongory_matcher_build_func_get(char *name);
29
-
30
- #endif
@@ -1,30 +0,0 @@
1
- /**
2
- * @file error.c
3
- * @brief Implements error type to string conversion for the Mongory library.
4
- */
5
- #include <mongory-core/foundations/error.h>
6
-
7
- /**
8
- * @brief Converts a mongory_error_type enum to its human-readable string
9
- * representation.
10
- *
11
- * This function uses the MONGORY_ERROR_TYPE_MACRO to generate a switch
12
- * statement that maps each error enum to its corresponding string.
13
- *
14
- * @param type The mongory_error_type enum value to convert.
15
- * @return const char* A string literal representing the error type. If the
16
- * type is not recognized, it returns "Unknown Error Type".
17
- */
18
- const char *mongory_error_type_to_string(enum mongory_error_type type) {
19
- switch (type) {
20
- // Use the X-Macro to generate case statements for each error type.
21
- #define DEFINE_ERROR_STRING(name, num, str) \
22
- case name: \
23
- return str;
24
- MONGORY_ERROR_TYPE_MACRO(DEFINE_ERROR_STRING)
25
- #undef DEFINE_ERROR_STRING // Undefine the macro after use.
26
- default:
27
- // Fallback for any undefined or unknown error types.
28
- return "Unknown Error Type";
29
- }
30
- }