C doesn't support exceptions but GLib has its own error reporting system. It's kind of verbose but it works ok.
Let's pretend we were making a JSON parser library, here's how the error reporting would work. (This example was actually derived from json-glib).
First we create an enum to represent different error codes.