After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730917 - ParserError detected as normal enum instead of ErrorDomain
ParserError detected as normal enum instead of ErrorDomain
Status: RESOLVED FIXED
Product: json-glib
Classification: Core
Component: GObject
1.0.x
Other Linux
: Normal minor
: ---
Assigned To: json-glib-maint
json-glib-maint
Depends on:
Blocks:
 
 
Reported: 2014-05-29 07:50 UTC by Peter Lejeck
Modified: 2014-05-29 09:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
introspection: include json-enum-types.{c,h} in GIR (1.09 KB, patch)
2014-05-29 08:02 UTC, Evan Nemerson
none Details | Review
build: Include enum-types.[ch] in the introspection sources (1.48 KB, patch)
2014-05-29 09:00 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Peter Lejeck 2014-05-29 07:50:31 UTC
The Vala bindings (which are autogenerated via introspection) seem to pick up the Json ParserError as an enum instead of ErrorDomain.

Steps to reproduce:
1. Attempt to use try { ... } catch (Json.ParserError err) { ... } in Vala

Results:
Fails to compile with "clause must catch a valid error type, found `Json.ParserError' instead"

Expected:
Vala will discover the ErrorDomain through Introspection and allow it to be caught.
Comment 1 Evan Nemerson 2014-05-29 07:54:28 UTC
JsonParserError doesn't seem to be registered, that's probably the cause.  The GIR doesn't include glib:error-domain, glib:type-name, or glib:get-type attributes.
Comment 2 Evan Nemerson 2014-05-29 08:02:48 UTC
Created attachment 277438 [details] [review]
introspection: include json-enum-types.{c,h} in GIR
Comment 3 Emmanuele Bassi (:ebassi) 2014-05-29 08:56:08 UTC
thanks for the patch. I ended up pushing something similar, but that uses the full path of the generated files to avoid issues
with srcdir != builddir scenarios (like distcheck).
Comment 4 Emmanuele Bassi (:ebassi) 2014-05-29 09:00:12 UTC
Created attachment 277440 [details] [review]
build: Include enum-types.[ch] in the introspection sources

Otherwise g-ir-scanner won't pick the types up, and will not notice that
the error enumerations have an associated error domain.