commit a39a752b1597392f2c2702115015705f2bdb1e36 parent 2ec7bfc78aa96828b52ba5f920fc3d46e2caddab Author: Daniel Barlow <dan@telent.net> Date: Thu, 7 Apr 2022 23:39:56 +0100 print error when failing to load image Diffstat:
| M | blinkenlicht/blinkenlicht.fnl | | | 8 | +++++++- |
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/blinkenlicht/blinkenlicht.fnl b/blinkenlicht/blinkenlicht.fnl @@ -60,11 +60,17 @@ (local found-icons {}) +(macro check-err [form] + `(let [(result# err#) ,form] + (or result# + (error err#)))) + (fn load-icon [name] (let [pixbuf (if (= (name:sub 1 1) "/") ;; From a direct path - (GdkPixbuf.Pixbuf.new_from_file_at_scale name HEIGHT -1 true) + (check-err + (GdkPixbuf.Pixbuf.new_from_file_at_scale name HEIGHT -1 true)) ;; From icon theme (find-icon-pixbuf name))] (Gtk.Image.new_from_pixbuf pixbuf)))