gnome-shell/js/ui/init.js
Philip Chimento 1692004b6b init: Improve error message formatting
Instead of manually formatting the error message and stack, use the same
formatting mechanism as we do when displaying errors to the user that
occur while opening extension preferences. This should correctly
indicate where syntax errors from imported modules occur.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3041>
2024-01-04 18:59:33 +00:00

23 lines
715 B
JavaScript

import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import './environment.js';
import {formatError} from '../misc/errorUtils.js';
// Run the Mutter main loop after
// GJS finishes resolving this module.
imports._promiseNative.setMainLoopHook(() => {
// Queue starting the shell
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
import('./main.js').then(main => main.start()).catch(e => {
const error = new GLib.Error(
Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED, formatError(e));
global.context.terminate_with_error(error);
});
return GLib.SOURCE_REMOVE;
});
// Run the meta context's main loop
global.context.run_main_loop();
});