Skip to content

Commit cbb2ff7

Browse files
committed
Add condition for not https errors
1 parent 8cf7d3d commit cbb2ff7

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

ql-https.lisp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
(:export
77
#:fetcher
88
#:*quietly-use-https*
9-
#:register-fetch-scheme-functions))
9+
#:register-fetch-scheme-functions
10+
#:no-https-error))
1011

1112
(in-package #:ql-https)
1213

14+
(define-condition no-https-error (error)
15+
((url :initarg :url
16+
:reader no-https-url))
17+
(:report (lambda (c stream)
18+
(format stream "We don't use HTTP here!~&URL: ~A" (no-https-url c)))))
19+
1320
(defvar *quietly-use-https* nil
1421
"If non-nil quietly use HTTPS.")
1522

@@ -35,11 +42,11 @@
3542
(verify-download file release))
3643
(values output file))
3744
(restart-case
38-
(handler-bind ((error (lambda (c)
39-
(declare (ignore c))
40-
(when *quietly-use-https*
41-
(invoke-restart 'use-https)))))
42-
(error "We don't use HTTP here!~&URL: ~A" url))
45+
(handler-bind ((no-https-error (lambda (c)
46+
(declare (ignore c))
47+
(when *quietly-use-https*
48+
(invoke-restart 'use-https)))))
49+
(error 'no-https-error :url url))
4350
(use-https ()
4451
:report "Retry with HTTPS."
4552
(apply #'fetcher

0 commit comments

Comments
 (0)