From 3f676b7b00eeb0fa71213232360c485fde9f5c8e Mon Sep 17 00:00:00 2001 From: Noella <49508517+ItsNoellaHere@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:20:31 -0700 Subject: [PATCH] Error Handling --- main/error_handling.lua | 24 ++++++++++++++++++++++++ rc.lua | 25 +------------------------ 2 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 main/error_handling.lua diff --git a/main/error_handling.lua b/main/error_handling.lua new file mode 100644 index 0000000..ae441ed --- /dev/null +++ b/main/error_handling.lua @@ -0,0 +1,24 @@ +local naughty = require("naughty") + +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) +end + +-- Handle runtime errors after startup +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end diff --git a/rc.lua b/rc.lua index 4e1d95a..1ca1965 100644 --- a/rc.lua +++ b/rc.lua @@ -18,30 +18,7 @@ local hotkeys_popup = require("awful.hotkeys_popup") -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") --- {{{ Error handling --- Check if awesome encountered an error during startup and fell back to --- another config (This code will only ever execute for the fallback config) -if awesome.startup_errors then - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors }) -end - --- Handle runtime errors after startup -do - local in_error = false - awesome.connect_signal("debug::error", function (err) - -- Make sure we don't go into an endless error loop - if in_error then return end - in_error = true - - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) }) - in_error = false - end) -end --- }}} +require("main.error_handling") -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers.