Re: GObject error handling questions



Le mardi 21 mai 2013 à 05:11 +0400, Nikita Churaev a écrit :
1. Is there a way for a GObject constructor to fail and report an error?
Yes, you should implement GInitiable

2. Is it possible to attach additional information to GError (file where
the error came from, line and column)? If not, what is the standard way
to report these?
No, GError::message is designed to be displayed on screen, error targeted to developers shall be displayed in the terminal (probably using g_error, or assertions). The domain and code shall be used whenever run-time handling of the error shall be made.

3. How to localize errors?
Like any other string in your applications _("text").

I hope that helps,
Nicolas

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]