gir icon indicating copy to clipboard operation
gir copied to clipboard

Error message is hard to understand and not very helpful

Open bochecha opened this issue 6 years ago • 8 comments

Running the gir tool against the GLib-2.0.gir file from glib 2.58 in sys work mode, I get the following:

GirXml: gir-files/GLib-2.0.gir:35680:11: Missing type name

And nothing else.

It took me a very long time to understand that the "35680" was the line number in the gir file. That could be made more explicit.

Second, what does "missing type name" even mean? If it means that the <type> tag needs a name attribute, then that too could be made more explicit? Maybe even printing back the exact line/tag?

Something like the following maybe:

gir-files/GLib-2.0.gir at line 35680: <type> is missing a name attribute:
    <type c:type="gatomicrefcount*"/>

Even better would be to keep in the amazing tradition of the Rustc/Cargo error message and suggest what should be done.

For example, if this is a bug and the gir file really should have it, then a suggestion to report the bug upstream along with an explanation of why that is wrong would be perfect. :slightly_smiling_face:

bochecha avatar Dec 26 '18 13:12 bochecha

In this case it is a bug in the gir file :)

sdroege avatar Dec 29 '18 10:12 sdroege

@sdroege I know, and it's already fixed upstream.

The point here is that figuring all this out could have been much easier with a better error message. @alatiera suggested I report this, to improve the UX of the gir tool.

bochecha avatar Dec 29 '18 17:12 bochecha

Ah great, I wasn't sure if it was clear that this is actually a bug in the .gir file. Can you give a link to the GLib issue about this?

I agree that the error reporting from the gir tool could be better :)

sdroege avatar Dec 29 '18 21:12 sdroege

@sdroege sure, this is the one I opened to ask for the fix to be backported in the latest stable release: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/254 (it has links to the original issue and the MR that fixed it in master)

bochecha avatar Dec 29 '18 21:12 bochecha

Mutter uses a lot of forward definitions in Cogl, so I've encountered tons of " is missing a name attribute" errors. What can I do about it?

saihaze avatar Jun 16 '23 12:06 saihaze

Pinging @zanderbrown as he worked already on rust bindings of mutter, so maybe you could use his work as a start

bilelmoussaoui avatar Jun 16 '23 12:06 bilelmoussaoui

They cheated and fixed up cogl in their fork, which sadly wasn't polished and upstreamed :/

ZanderBrown avatar Jun 17 '23 18:06 ZanderBrown

There isn't much to upstream anyway. Cogl has been archived go years at this point.

alatiera avatar Aug 26 '23 12:08 alatiera