Reporting complex errors with GError
Submitted by David Malcolm
Link to original bug (#124022)
Description
I would like to be able to store "complicated" error reports in GError, making it more closely like exception handling in e.g. C++ and Java.
For example, if an XML document is not well-formed, I would like to be able to pass a struct containing complete file & line number information about all of the parser errors back to my GUI and provide a sensible user interface for this. I've got this working at the moment, but as soon as I reach a GError interface I have no way of preserving the rich information, and can only save a string.
So I would like to be able to store arbitrary user data in a GError.
Attached is a rough idea about what I had in mind. Unfortunately it breaks GLib ABI compatibility.
The idea is that you can store some kind of user data and have it copied, freed etc as the GError is copied and freed, and code can interpret it in a meaningful way if it recognises the domain and code.