diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-03-13 21:00:14 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-03-13 21:00:14 -0500 |
commit | 0c017ecd3491d062d63ffa2e87d9198f5fd392b2 (patch) | |
tree | a823348f64b26da82572349d5dc2878ab4884003 | |
parent | 76e8f4df290327addf75cd61ca822c93fcc32f4a (diff) |
graphics: engine: Improve error message when graphics state is undefined.
-rw-r--r-- | chickadee/graphics/engine.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chickadee/graphics/engine.scm b/chickadee/graphics/engine.scm index 1531e3f..631f792 100644 --- a/chickadee/graphics/engine.scm +++ b/chickadee/graphics/engine.scm @@ -3,6 +3,7 @@ #:use-module (chickadee math matrix) #:use-module (gl) #:use-module (ice-9 atomic) + #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -232,7 +233,13 @@ (define* (graphics-engine-state-ref name #:optional (engine (current-graphics-engine))) - (graphics-state-ref (hashq-ref (graphics-engine-states engine) name))) + (let ((state (hashq-ref (graphics-engine-states engine) name))) + (if state + (graphics-state-ref state) + (error + (format #f + "No such graphics state '~a'. Did you include the module that defines it?" + name))))) (define* (graphics-engine-state-set! name value #:optional (engine (current-graphics-engine))) |