如何检查 Gnome/gjs/Gio 中的错误代码

How can I check error code in Gnome/gjs/Gio

这不起作用(目录存在时没有任何反应):

let s_dir = Gio.file_new_for_path("./S1");
try {
        s_dir.make_directory(null);
} catch(e) {
        if(e == Gio.IOErrorEnum.EXISTS)
            print(e);
}

使用GLib.Error.matches()方法:

let s_dir = Gio.file_new_for_path("./S1");
try {
        s_dir.make_directory(null);
} catch(e) {
        if (e.matches (Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)
            print(e);
}