Merge pull request #2903 from krytarowski/netbsd-support-4
[mono.git] / mono / metadata / exception.h
1 #ifndef _MONO_METADATA_EXCEPTION_H_
2 #define _MONO_METADATA_EXCEPTION_H_
3
4 #include <glib.h>
5 #include <mono/metadata/object.h>
6 #include <mono/metadata/image.h>
7
8 MONO_BEGIN_DECLS
9
10 extern MONO_API MonoException *
11 mono_exception_from_name               (MonoImage *image, 
12                                         const char* name_space, 
13                                         const char *name);
14
15 MONO_API MonoException *
16 mono_exception_from_token              (MonoImage *image, uint32_t token);
17
18 MONO_RT_EXTERNAL_ONLY
19 MONO_API MonoException *
20 mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
21                                       const char *name, MonoString *a1, MonoString *a2);
22
23 MONO_API MonoException *
24 mono_exception_from_name_msg           (MonoImage *image, const char *name_space,
25                                         const char *name, const char *msg);
26
27 MONO_RT_EXTERNAL_ONLY
28 MONO_API MonoException *
29 mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
30                                                    MonoString *a1, MonoString *a2);
31
32 extern MONO_API MonoException *
33 mono_exception_from_name_domain        (MonoDomain *domain, MonoImage *image, 
34                                         const char* name_space, 
35                                         const char *name);
36
37 MONO_API MonoException *
38 mono_get_exception_divide_by_zero      (void);
39
40 MONO_API MonoException *
41 mono_get_exception_security            (void);
42
43 MONO_API MonoException *
44 mono_get_exception_arithmetic          (void);
45
46 MONO_API MonoException *
47 mono_get_exception_overflow            (void);
48
49 MONO_API MonoException *
50 mono_get_exception_null_reference      (void);
51
52 MONO_API MonoException *
53 mono_get_exception_execution_engine    (const char *msg);
54
55 MONO_API MonoException *
56 mono_get_exception_thread_abort        (void);
57
58 MONO_API MonoException *
59 mono_get_exception_thread_state        (const char *msg);
60
61 MONO_API MonoException *
62 mono_get_exception_thread_interrupted  (void);
63
64 MONO_API MonoException *
65 mono_get_exception_serialization       (const char *msg);
66
67 MONO_API MonoException *
68 mono_get_exception_invalid_cast        (void);
69
70 MONO_API MonoException *
71 mono_get_exception_invalid_operation (const char *msg);
72
73 MONO_API MonoException *
74 mono_get_exception_index_out_of_range  (void);
75
76 MONO_API MonoException *
77 mono_get_exception_array_type_mismatch (void);
78
79 MONO_API MonoException *
80 mono_get_exception_type_load           (MonoString *class_name, char *assembly_name);
81
82 MONO_API MonoException *
83 mono_get_exception_missing_method      (const char *class_name, const char *member_name);
84
85 MONO_API MonoException *
86 mono_get_exception_missing_field       (const char *class_name, const char *member_name);
87
88 MONO_API MonoException *
89 mono_get_exception_not_implemented     (const char *msg);
90
91 MONO_API MonoException *
92 mono_get_exception_not_supported       (const char *msg);
93
94 MONO_API MonoException*
95 mono_get_exception_argument_null       (const char *arg);
96
97 MONO_API MonoException *
98 mono_get_exception_argument            (const char *arg, const char *msg);
99
100 MONO_API MonoException *
101 mono_get_exception_argument_out_of_range (const char *arg);
102
103 MONO_API MonoException *
104 mono_get_exception_io                    (const char *msg);
105
106 MONO_API MonoException *
107 mono_get_exception_file_not_found        (MonoString *fname);
108
109 MONO_API MonoException *
110 mono_get_exception_file_not_found2       (const char *msg, MonoString *fname);
111
112 MONO_RT_EXTERNAL_ONLY
113 MONO_API MonoException *
114 mono_get_exception_type_initialization (const char *type_name, MonoException *inner);
115
116 MONO_API MonoException *
117 mono_get_exception_synchronization_lock (const char *msg);
118
119 MONO_API MonoException *
120 mono_get_exception_cannot_unload_appdomain (const char *msg);
121
122 MONO_API MonoException *
123 mono_get_exception_appdomain_unloaded (void);
124
125 MONO_API MonoException *
126 mono_get_exception_bad_image_format (const char *msg);
127
128 MONO_API MonoException *
129 mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname);
130
131 MONO_API MonoException *
132 mono_get_exception_stack_overflow (void);
133
134 MONO_API MonoException *
135 mono_get_exception_out_of_memory (void);
136
137 MONO_API MonoException *
138 mono_get_exception_field_access (void);
139
140 MONO_API MonoException *
141 mono_get_exception_method_access (void);
142
143 MONO_RT_EXTERNAL_ONLY
144 MONO_API MonoException *
145 mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions);
146
147 MONO_RT_EXTERNAL_ONLY
148 MONO_API MonoException *
149 mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);
150
151 /* Installs a function which is called when the runtime encounters an unhandled exception.
152  * This hook isn't expected to return.
153  * If no hook has been installed, the runtime will print a message before aborting.
154  */
155 typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, gpointer user_data);
156 MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
157 void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
158
159 MONO_END_DECLS
160
161 #endif /* _MONO_METADATA_EXCEPTION_H_ */