1
0
Fork 0

- [gemini] returned the meta header to user when a protocol error occurred.

This commit is contained in:
cage 2023-03-12 11:42:55 +01:00
parent 3a5ea0fac9
commit d4a871d769
3 changed files with 12 additions and 6 deletions

View File

@ -228,12 +228,16 @@
:reader error-code)
(error-description
:initarg :error-description
:reader error-description))
:reader error-description)
(meta
:initarg :meta
:reader meta))
(:report (lambda (condition stream)
(format stream
(_ "The server responded with the error ~a: ~s")
(_ "The server responded with the error ~a (~a): ~a")
(error-code condition)
(error-description condition))))
(error-description condition)
(meta condition))))
(:documentation "The condition signalled for error codes (i.e. 4x and 5x)"))
(define-condition gemini-tofu-error (error)
@ -345,7 +349,8 @@
(let ((response-code (find-code-class status-code)))
(error 'gemini-protocol-error
:error-code (code response-code)
:error-description (description response-code))))
:error-description (description response-code)
:meta meta)))
;; ((header-not-implemented-p parsed-header)
;; (error 'conditions:not-implemented-error
;; :text (_ "The server requested a certificate but client validation is not implemented by this program")))

View File

@ -486,7 +486,8 @@
((or (gemini-client:header-temporary-failure-p status-code)
(gemini-client:header-permanent-failure-p status-code)
(gemini-client:header-certificate-failure-p status-code))
(error (_ "Error connecting to: ~a:~2%~a") iri status-description))
(error (_ "~a ~a Error connecting to: ~a:~2%~a")
status-code status-description iri meta))
((gemini-client:header-redirect-p status-code)
(when (gui:ask-yesno (format nil (_ "Follow redirection to ~a?") meta)
:title (_ "Redirection")

View File

@ -213,7 +213,7 @@
(gemini-client:gemini-protocol-error (e)
(make-gemini-response (gemini-client:error-code e)
(gemini-client:error-description e)
""
(gemini-client:meta e)
url))
(error (e)
(error (_ "Error getting ~s: ~a") url e))