diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-03-25 15:14:42 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-03-25 15:14:42 -0400 |
commit | c361695dab9869566fe9b7c60ca0a8bf76f987ef (patch) | |
tree | 674e01b4222a7a08f22cee3cba1badfef6e38eea | |
parent | ed86ebe80152a21697c98eba9f30586c7ce1a9cf (diff) |
image: Improve exceptions.
-rw-r--r-- | chickadee/image.scm | 18 |
1 files 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 <image> @@ -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) |