> I noticed this one in MethodBody.cs:
> 
> public void HandleException (StreamWriter sw, string indent)
> {
>       if (!ThrowsException)
>               return;
>       sw.WriteLine (indent + "\t\t\tif (error != IntPtr.Zero) throw new
> GLib.GException (error);");
> }
> 
> It would be nicer if I could put an exception creator here, in stead of
> having to use GException. For example one that creates me a specific
> type of Exception depending on the GError's domain and error code.
> 
> Just like last question, the one about the asynchronous APIs, is
> something in place already to do this kind of things?

No, the GError conversion is hardcoded to GException currently.

> I was thinking about something like this:
> 
> <add-node path="/api"><symbol name="ExceptionFactory"
> creater="Tny.ExceptionFactory.Create" /></add-node>

I would probably implement this via an error_handler attribute on the
namespace element.  That way a different handler per library is possible
in api's with multiple namespaces and libraries.

A property on GenBase could expose it to the generator.
> 
> public void HandleException (StreamWriter sw, string indent)
> {
>       if (!ThrowsException)
>               return;
>       sw.WriteLine (indent + "\t\t\tif (error != IntPtr.Zero) throw {0}
> (error);", 
>               ExceptionFactory.Instance.ToString(););
> }

Probably would just add a parameter to HandleException to allow Ctor and
Method to pass in the error_handler.  Both of those classes could just
look it up on their container_type.

Feel free to add an enhancement bug for this, and patches are welcome, of 
course.

-- 
Mike Kestner <[EMAIL PROTECTED]>

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to