e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
83 lines
5.3 KiB
HTML
83 lines
5.3 KiB
HTML
<h2>Exception Handling</h2>
|
|
|
|
<p>Mono's exception handling contains methods
|
|
to <a href="#creating">create `MonoException*` objects</a>
|
|
that can be <a href="api:mono_raise_exception">raised</a>.
|
|
|
|
<p>Alternatively, you can obtain an exception that you can
|
|
raise from some of the most <a href="#common">common</a>
|
|
exceptions in the .NET Runtime.
|
|
|
|
<h3>Raising and Catching exceptions</h3>
|
|
|
|
<p>If you plan on running your code in Mono's Cooperative mode
|
|
for the Garbage Collector (for example, if you are using pure
|
|
Bitcode code generation), it you should avoid raising an
|
|
exception from any method that is not the entry point to the
|
|
internal call.
|
|
|
|
<p>It is recommended that if you need to raise an error
|
|
condition from nested parts of your code, surface this error
|
|
to the topmost method that is surfaced as an internal call and
|
|
raise the exception there.
|
|
|
|
|
|
<h4><a name="api:mono_raise_exception">mono_raise_exception</a></h4>
|
|
<h4><a name="api:mono_unhandled_exception">mono_unhandled_exception</a></h4>
|
|
<h4><a name="api:mono_print_unhandled_exception">mono_print_unhandled_exception</a></h4>
|
|
|
|
<a name="creating"/>
|
|
<h3>Exception Types: General API</h3>
|
|
|
|
<h4><a name="api:mono_exception_from_name_domain">mono_exception_from_name_domain</a></h4>
|
|
<h4><a name="api:mono_exception_from_name">mono_exception_from_name</a></h4>
|
|
<h4><a name="api:mono_exception_from_name_msg">mono_exception_from_name_msg</a></h4>
|
|
<h4><a name="api:mono_exception_from_name_two_strings">mono_exception_from_name_two_strings</a></h4>
|
|
|
|
<a name="common"/>
|
|
<h3>Obtaining Common Exceptions</h3>
|
|
|
|
<p>There are a number of common exceptions that are used by
|
|
the runtime, use the routines in this section to get a copy of
|
|
those exceptions.
|
|
|
|
<h4><a name="api:mono_get_exception_appdomain_unloaded">mono_get_exception_appdomain_unloaded</a></h4>
|
|
<h4><a name="api:mono_get_exception_argument">mono_get_exception_argument</a></h4>
|
|
<h4><a name="api:mono_get_exception_argument_null">mono_get_exception_argument_null</a></h4>
|
|
<h4><a name="api:mono_get_exception_argument_out_of_range">mono_get_exception_argument_out_of_range</a></h4>
|
|
<h4><a name="api:mono_get_exception_arithmetic">mono_get_exception_arithmetic</a></h4>
|
|
<h4><a name="api:mono_get_exception_array_type_mismatch">mono_get_exception_array_type_mismatch</a></h4>
|
|
<h4><a name="api:mono_get_exception_bad_image_format">mono_get_exception_bad_image_format</a></h4>
|
|
<h4><a name="api:mono_get_exception_cannot_unload_appdomain">mono_get_exception_cannot_unload_appdomain</a></h4>
|
|
<h4><a name="api:mono_get_exception_class">mono_get_exception_class</a></h4>
|
|
<h4><a name="api:mono_get_exception_divide_by_zero">mono_get_exception_divide_by_zero</a></h4>
|
|
<h4><a name="api:mono_get_exception_execution_engine">mono_get_exception_execution_engine</a></h4>
|
|
<h4><a name="api:mono_get_exception_file_not_found2">mono_get_exception_file_not_found2</a></h4>
|
|
<h4><a name="api:mono_get_exception_file_not_found">mono_get_exception_file_not_found</a></h4>
|
|
<h4><a name="api:mono_get_exception_index_out_of_range">mono_get_exception_index_out_of_range</a></h4>
|
|
<h4><a name="api:mono_get_exception_invalid_cast">mono_get_exception_invalid_cast</a></h4>
|
|
<h4><a name="api:mono_get_exception_io">mono_get_exception_io</a></h4>
|
|
<h4><a name="api:mono_get_exception_missing_method">mono_get_exception_missing_method</a></h4>
|
|
<h4><a name="api:mono_get_exception_not_implemented">mono_get_exception_not_implemented</a></h4>
|
|
<h4><a name="api:mono_get_exception_null_reference">mono_get_exception_null_reference</a></h4>
|
|
<h4><a name="api:mono_get_exception_overflow">mono_get_exception_overflow</a></h4>
|
|
<h4><a name="api:mono_get_exception_security">mono_get_exception_security</a></h4>
|
|
<h4><a name="api:mono_get_exception_serialization">mono_get_exception_serialization</a></h4>
|
|
<h4><a name="api:mono_get_exception_stack_overflow">mono_get_exception_stack_overflow</a></h4>
|
|
<h4><a name="api:mono_get_exception_synchronization_lock">mono_get_exception_synchronization_lock</a></h4>
|
|
<h4><a name="api:mono_get_exception_thread_abort">mono_get_exception_thread_abort</a></h4>
|
|
<h4><a name="api:mono_get_exception_thread_state">mono_get_exception_thread_state</a></h4>
|
|
<h4><a name="api:mono_get_exception_type_initialization">mono_get_exception_type_initialization</a></h4>
|
|
<h4><a name="api:mono_get_exception_type_load">mono_get_exception_type_load</a></h4>
|
|
<h4><a name="api:mono_get_exception_invalid_operation">mono_get_exception_invalid_operation</a></h4>
|
|
<h4><a name="api:mono_get_exception_missing_field">mono_get_exception_missing_field</a></h4>
|
|
<h4><a name="api:mono_get_exception_not_supported">mono_get_exception_not_supported</a></h4>
|
|
<h4><a name="api:mono_get_exception_reflection_type_load">mono_get_exception_reflection_type_load</a></h4>
|
|
<h4><a name="api:mono_exception_from_token_two_strings">mono_exception_from_token_two_strings</a></h4>
|
|
<h4><a name="api:mono_get_exception_bad_image_format2">mono_get_exception_bad_image_format2</a></h4>
|
|
<h4><a name="api:mono_get_exception_field_access">mono_get_exception_field_access</a></h4>
|
|
<h4><a name="api:mono_get_exception_method_access">mono_get_exception_method_access</a></h4>
|
|
<h4><a name="api:mono_get_exception_out_of_memory">mono_get_exception_out_of_memory</a></h4>
|
|
<h4><a name="api:mono_get_exception_runtime_wrapped">mono_get_exception_runtime_wrapped</a></h4>
|
|
<h4><a name="api:mono_get_exception_thread_interrupted">mono_get_exception_thread_interrupted</a></h4>
|