main: Improve error formatting in logError()

We override GJS's default logError(). This adds the improved formatting
of error stack traces that gjs-console would otherwise do as part of
logError().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3041>
This commit is contained in:
Philip Chimento 2024-01-02 16:24:13 -08:00 committed by Florian Müllner
parent a1a320d3d1
commit e6f35c5e88

View File

@ -45,6 +45,7 @@ import * as XdndHandler from './xdndHandler.js';
import * as KbdA11yDialog from './kbdA11yDialog.js';
import * as LocatePointer from './locatePointer.js';
import * as PointerA11yTimeout from './pointerA11yTimeout.js';
import {formatError} from '../misc/errorUtils.js';
import * as ParentalControlsManager from '../misc/parentalControlsManager.js';
import * as Util from '../misc/util.js';
@ -144,7 +145,7 @@ function _sessionUpdated() {
export async function start() {
globalThis.log = console.log;
globalThis.logError = function (err, msg) {
const args = [err];
const args = [formatError(err)];
try {
// toString() can throw
if (msg)