Merge pull request #2462 from ludovic-henry/monoerror-mono_object_new_specific
[mono.git] / mono / utils / mono-error.h
1 #ifndef __MONO_ERROR_H__
2 #define __MONO_ERROR_H__
3
4 #include <mono/utils/mono-publib.h>
5
6 enum {
7         /*
8         The supplied strings were dup'd by means of calling mono_error_dup_strings.
9         */
10         MONO_ERROR_FREE_STRINGS = 0x0001,
11
12         /*
13         Something happened while processing the error and the resulting message is incomplete.
14         */
15         MONO_ERROR_INCOMPLETE = 0x0002
16 };
17
18 enum {
19         MONO_ERROR_NONE = 0,
20         MONO_ERROR_MISSING_METHOD = 1,
21         MONO_ERROR_MISSING_FIELD = 2,
22         MONO_ERROR_TYPE_LOAD = 3,
23         MONO_ERROR_FILE_NOT_FOUND = 4,
24         MONO_ERROR_BAD_IMAGE = 5,
25         MONO_ERROR_OUT_OF_MEMORY = 6,
26         MONO_ERROR_ARGUMENT = 7,
27         MONO_ERROR_NOT_VERIFIABLE = 8,
28         /*
29          * This is a generic error mechanism is you need to raise an arbitrary corlib exception.
30          * You must pass the exception name otherwise prepare_exception will fail with internal execution. 
31          */
32         MONO_ERROR_GENERIC = 9
33 };
34
35 /*Keep in sync with MonoErrorInternal*/
36 typedef struct _MonoError {
37         unsigned short error_code;
38     unsigned short hidden_0; /*DON'T TOUCH */
39
40         void *hidden_1 [12]; /*DON'T TOUCH */
41 } MonoError;
42
43 MONO_BEGIN_DECLS
44
45 MONO_API void
46 mono_error_init (MonoError *error);
47
48 MONO_API void
49 mono_error_init_flags (MonoError *error, unsigned short flags);
50
51 MONO_API void
52 mono_error_cleanup (MonoError *error);
53
54 MONO_API mono_bool
55 mono_error_ok (MonoError *error);
56
57 MONO_API unsigned short
58 mono_error_get_error_code (MonoError *error);
59
60 MONO_API const char*
61 mono_error_get_message (MonoError *error);
62
63 MONO_END_DECLS
64
65 #endif