140
143
s_error_print_error (SError * self);
149
I have been thinking about Error Propagation in SSTS and GLib.
151
I noticed that errors in GLib does not rely propagate, you can do
152
g_error_propagate () but that assumes that the error that is fed to the function
153
is an array. This assumption can never be made and makes it very complex to deal
154
with different ways of doing things in different parts of a program (GError * vs
157
So what I am thinking of doing is a little more complex: have explicit
158
registration of error domains (s_error_domain_register (schar * name,
159
FuncPointer to_string), s_error_domain_is_registered (schar *)).
161
The other thing I was thinking is that errors should have implicit propagation.
162
(IE: no s_error_new () only s_error_append ()) and have the propagation
163
information stored in an array. (ID and message).
165
The problem with this is that where do you call s_error_domain_register ()?
167
In the constructor of an SObject would be a great place to put it, if not for
168
the problem that we have to call s_error_domain_is_registered when a new
169
instance of an object is created.
171
In the main function is just tedious, Wrapping the main function in something
172
like an S_MAIN macro could work and have an internal
173
s_library_register_error_domains function somewhere and require the user to
174
implement an s_user_register_error_domains function.
176
This puts even more work on the shoulders of the developers that uses the
179
It seems that no matter what I do (A true propagating error system or
180
something like GError from GLib) I put extra work in the lap of the developer
181
that uses the library.
188
s_error_domain_register (schar * domain, SErrorDomainToString func);
191
s_error_domain_is_registerd (schar * domain);