[Mono-dev] [PATCH] Extract mono_exception_get_message_string from mono_print_exception

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Jul 2 15:13:27 EDT 2010


On Fri, Jul 2, 2010 at 6:28 AM, Paolo Molaro <lupus at ximian.com> wrote:
> On 07/01/10 Michael Hutchinson wrote:
>> The attached patch adds a new mono_exception_get_message_string
>> function to the Mono public API, extracted from mono_print_exception.
>> This makes it possible for embedders easily to convert exceptions to
>> strings without printing them and without using private API.
>
> It is already possible to use the embedding API to get the same result
> without using any private API, of course.

My bad, I hadn't found mono_get_exception_class.

> Anyway, we can certainly add an helper method, but it should be more
> general:
>
> MonoString *mono_object_to_string (MonoObject *obj, MonoObject **exc);
>
> Note that it works for any object and that it allows the user to
> handle exceptions thrown from the implict method invocation.
> The result can be used as is or mono_string_to_utf8 () can be called on

Implemented - new patch attached.

I also made mono_string_to_utf8_checked public, as mono_string_to_utf8
is marked deprecated.

-- 
Michael Hutchinson
http://mjhutchinson.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono-print-exception.diff
Type: application/octet-stream
Size: 5140 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100702/3afe58a7/attachment-0001.obj 


More information about the Mono-devel-list mailing list