GSettings override in Gio.js may fail on construction
System information
- Fedora 34 (Silverblue)
- gjs-1.68.1
Bug information
Steps to reproduce
Just like so:
const {Gio} = imports.gi;
const settings = new Gio.Settings({
settings_schema: 'tld.foo.Bar',
});
Note I've "accidentally" swapped schema_id
for settings_schema
, which results in an error like so:
TypeError: settingsSchema.get_path is not a function
_init@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:541:55
<snip>
The backtrace will lead the developer to the object construction, but will not indicate what has happened.
This is because we accept either schema-id
or settings-schema
, but assume the settingsSchema
variable holds a GSettingsSchema object when it may be something else.
Expected behaviour
I guess the reasonable thing to do here is do an instanceof
check if the passed property is settings-schema
to throw a proper error.