From b1ae9699b83faee738d92f39231d7f703866996c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 15 Feb 2014 17:11:37 -0500 Subject: Throw error if shader file does not exist. * 2d/shader.scm (load-shader): Add exception handling. --- 2d/shader.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '2d') diff --git a/2d/shader.scm b/2d/shader.scm index 8c47cdc..89b93fe 100644 --- a/2d/shader.scm +++ b/2d/shader.scm @@ -123,7 +123,9 @@ contained in the string SOURCE." (define (load-shader type filename) "Create a new GLSL shader of the given TYPE (vertex or fragment) and compile the GLSL program stored in the file FILENAME." - (make-shader type (call-with-input-file filename read-string))) + (if (file-exists? filename) + (make-shader type (call-with-input-file filename read-string)) + (error "File not found!" filename))) (define (load-vertex-shader filename) "Create a new GLSL vertex shader and compile the GLSL program stored -- cgit v1.2.3