error handling

This commit is contained in:
Victor Fors 2022-04-20 23:55:29 +02:00
parent ab7bd261e6
commit e324e94aff

View File

@ -7,6 +7,7 @@
(import (chicken io)) (import (chicken io))
(import srfi-13) (import srfi-13)
(import srfi-14) (import srfi-14)
(import (chicken condition))
(define (curry fn a) (define (curry fn a)
(lambda (b) (lambda (b)
@ -73,7 +74,9 @@
;;; Get data from a uri and parse it as json. ;;; Get data from a uri and parse it as json.
(define (simple-json-request uri) (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 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 ;;; The Linköping municipal open data API key generator portal is located at http://opendata.linkoping.se