From e324e94aff3457780d5a878c51cc180b9cfea907 Mon Sep 17 00:00:00 2001 From: Victor Fors Date: Wed, 20 Apr 2022 23:55:29 +0200 Subject: [PATCH] error handling --- parking.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parking.scm b/parking.scm index b3e1037..89a8f21 100644 --- a/parking.scm +++ b/parking.scm @@ -7,6 +7,7 @@ (import (chicken io)) (import srfi-13) (import srfi-14) +(import (chicken condition)) (define (curry fn a) (lambda (b) @@ -73,7 +74,9 @@ ;;; Get data from a uri and parse it as json. (define (simple-json-request uri) - (with-input-from-request uri #f read-json)) + (condition-case (with-input-from-request uri #f read-json) + ((exn i/o net) (begin (display-newline "Connection failed.") + (exit 1))))) ;;; The API key is an alphanumeric string of length 32 ;;; The Linköping municipal open data API key generator portal is located at http://opendata.linkoping.se