From c361695dab9869566fe9b7c60ca0a8bf76f987ef Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 25 Mar 2023 15:14:42 -0400 Subject: image: Improve exceptions. --- chickadee/image.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/chickadee/image.scm b/chickadee/image.scm index c5ec5dc..289fb14 100644 --- a/chickadee/image.scm +++ b/chickadee/image.scm @@ -39,6 +39,18 @@ read-image write-image)) +(define &image-error + (make-exception-type '&image-error &error '())) + +(define make-image-error (record-constructor &image-error)) + +(define (image-error message irritants) + (raise-exception + (make-exception + (make-image-error) + (make-exception-with-message message) + (make-exception-with-irritants irritants)))) + ;; An image is pixel data that is stored on disk in one of a variety ;; of formats. (define-record-type @@ -62,12 +74,6 @@ ("png" 'png) (_ 'unknown))) -(define (image-error message irritants) - (raise-exception - (make-exception - (make-exception-with-message message) - (make-exception-with-irritants irritants)))) - (define* (read-image image) "Read data from IMAGE and return a pixbuf." (define-values (pixels width height) -- cgit v1.2.3