[gst-devel] what do people think about GError?

Benjamin Otte in7y118 at public.uni-hamburg.de
Tue Apr 9 17:47:13 CEST 2002

On 9 Apr 2002, Bastien Nocera wrote:

> On Sun, 2002-04-07 at 02:31, Andy Wingo wrote:
> > when should it be used in gst, etc...
> >
> > i already have it in gstparse, as that's an obvious application.
> >
> > check the glib2 reference if you're not familiar.
> Yup, yup, like it a lot. Would be cool to have such a thing for when
> adding elements to the pipeline, and setting a state on a pipeline, ie.
> better user errors, for example:
> - "Couldn't open file:///foo: Permission denied"
> - "Couldn't find plugin bar"
> GError should be used in all the cases where the user will affect the
> user, and the application should use the GError to display a nice error
> message, be it a dialog box, or on the CLI.
> It shouldn't be used for "programming" errors, like "foo isn't supposed
> to be NULL but it is", only for user visible errors.
> Cheers
> --
> /Bastien Nocera
> http://hadess.net

I don't think GError should be used much in any library. It clutters up
the code and makes it harder to understand (just look at the examples).

Input validation is most of the time a job that the application should do.
Only functions that do user input validation (like gstparse) should use

I really don't think function like gst_elementfactory_make should use
GError to indicate if the error was "no such element", "not enough memory"
or something else. If you're really interested in that, you can check this
in advance.

I really hate this as much as the Java "throws" stuff, where you end up
with a function that can throw fifteen different Exceptions and can't read
your own code.

Sorry for ranting,


PS: I don't think that the parsing stuff belongs into the core anyway. Or
is there anything but -launch that uses it?

More information about the gstreamer-devel mailing list