> On Saturday, 6 January 2018, 11:24:01 GMT, Michele Dionisio 
> <michele.dioni...@gmail.com> wrote: 

> but this is not true, infact in documentation of glib method
> g_data_input_stream_read_line ()
> we have
> error                      GError for error reporting.

GError is the mechanism in C for returning the error. It is the standard 
mechanism across
GLib and doesn't give any indication of the type of errors that can be 
returned. The GError
conventions allows for bindings to recognise the mechanism. For example in 
Python, PyGObject
allows the try...except syntax to be used when it recognises GError. So having 
the GError
parameter in the C documentation doesn't mean it will raise any error, although 
technically it
could.

The documentation for GIOError ( 
https://developer.gnome.org/gio/stable/gio-GIOError.html ) 
shows functions for converting standing C errno.h errors to GIOError ( 
g_io_error_from_errno () )
and converting Windows errors to GIOError ( g_io_error_from_win32_error () ). 
Also G_IO_ERROR
is described as the "Error domain for GIO". My interpretation of that is GIO is 
providing an
abstraction over errors from different implementations.

> an example of this problem can be reached if you do
> var fileInStream = new DataInputStream ( new ConverterInputStream
> and ConverterInputStream can raise any possible GError and not only IO.

A quick look over https://developer.gnome.org/gio/stable/GConverter.html shows 
only
GIOErrors. The reference to G_CONVERTER_ERROR is a result code for 
GConverterResult.

> do you think that I have to raise a bug for that?

If you are writing a GConverter then I think you should be throwing IOErrors. 
The GIOError
documentation advises "In general, new error codes either only apply to new 
APIs, or else 
replace G_IO_ERROR_FAILED in cases that were not explicitly distinguished 
before." If your
error does not have an equivalent then use G_IO_ERROR_FAILED.

I don't currently believe this is a bug in the Vala bindings.

All the best,

Al


_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to