From da525054e5312d466b3e3d8b6e694a78e1ce6410 Mon Sep 17 00:00:00 2001 From: Aylur Date: Mon, 23 Oct 2023 02:20:31 +0200 Subject: [PATCH] feat: log css errors --- src/app.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index b12095b..0557036 100644 --- a/src/app.ts +++ b/src/app.ts @@ -67,7 +67,17 @@ export class App extends Gtk.Application { } const cssProvider = new Gtk.CssProvider(); - cssProvider.load_from_path(path); + cssProvider.connect('parsing-error', (_, section, err) => { + const file = section.get_file().get_path(); + const location = section.get_start_line(); + console.error(`CSS ERROR: ${err.message} at line ${location} in ${file}`); + }); + + try { + cssProvider.load_from_path(path); + } catch (_) { + // log on parsing-error + } Gtk.StyleContext.add_provider_for_screen( screen,