GNOME Bugzilla – Bug 698182
Gio.query_file_type error message is really confusing
Last modified: 2013-04-19 15:15:42 UTC
Let's try the following code: Gio.query_file_type(null, null); This output the following error: Unexpected unregistered type unpacking GArgument from Object With the additional message: Exception was set even though JS_EvaluateScript() returned true - did you gjs_throw() but not return false somewhere perhaps? Such a message is really confusing and doesn't help at all to find the fix.
This is what I get: TypeError: imports.gi.Gio.query_file_type is not a function And rightly so, the function actually is: Gio.File.prototype.query_file_type(); And even better, if I call it directly (without using .call()), I get: TypeError: Object 0x7fbcaee328e0 is not a subclass of GObject_Object, it's a GObject_Interface
Forgot to say I'm still running Gnome 3.6.2. The exact code was: http://fpaste.org/PXKi/
Ok, with this it becomes reproducible in master too. For the record, the error is that you're calling query_file_type(null, null), while you should call query_file_type(0, null). Patch coming.
Created attachment 241760 [details] [review] Improve error message when passing objects to flags Instead of complaining that we don't know how to handle an unregistered type from an object (unregistered because of a missing enum value in the switch), recognize that for enum and flags types we expect a number, and report a type mismatch. After the patch, the error becomes: Expected type flags for Argument 'flags' but got type 'object'
Review of attachment 241760 [details] [review]: OK.
I know Giovanni, it took me a while to find the correct form: this._folder.query_file_type(Gio.FileQueryInfoFlags.NONE, null) Thanks guys, you're damned quick!
Attachment 241760 [details] pushed as b5d40cb - Improve error message when passing objects to flags