mirror of https://codeberg.org/cage/tinmop/
- [RPC] resignalled TOFU error to client in a structured form to let the user deal with it;
- [GUI] improved protocol error messages.
This commit is contained in:
parent
74b32349f6
commit
c90c7289d9
|
@ -471,6 +471,19 @@
|
|||
original-iri)
|
||||
(displace-gemini-response connecting-response)
|
||||
(cond
|
||||
((= status-code comm:+tofu-error-status-code+)
|
||||
(when (gui:ask-yesno meta
|
||||
:title (_ "Server certificate error")
|
||||
:parent main-window)
|
||||
(cev:enqueue-request-and-wait-results :gemini-delete-certificate
|
||||
1
|
||||
ev:+maximum-event-priority+
|
||||
iri)
|
||||
(start-stream-iri iri main-window use-cache status)))
|
||||
((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))
|
||||
((gemini-client:header-redirect-p status-code)
|
||||
(when (gui:ask-yesno (format nil (_ "Follow redirection to ~a?") meta)
|
||||
:title (_ "Redirection")
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
(defclass iri-complete-response (box) ())
|
||||
|
||||
(a:define-constant +tofu-error-status-code+ -1 :test #'=)
|
||||
|
||||
(defmethod yason:encode ((object iri-complete-response) &optional (stream *standard-output*))
|
||||
(let ((json:*symbol-encoder* #'json:encode-symbol-as-lowercase)
|
||||
(yason:*list-encoder* #'yason:encode-plist)
|
||||
|
@ -202,11 +204,17 @@
|
|||
:certificate certificate
|
||||
:certificate-key certificate-key))))
|
||||
(gemini-client:gemini-tofu-error (e)
|
||||
(error "TOFU error: ~a" e))
|
||||
(make-gemini-response +tofu-error-status-code+
|
||||
(format nil "~a" e)
|
||||
(format nil "~a" e)
|
||||
url))
|
||||
(conditions:not-implemented-error (e)
|
||||
(error (_ "Error: ~a") e))
|
||||
(gemini-client:gemini-protocol-error (e)
|
||||
(error "~a" e))
|
||||
(make-gemini-response (gemini-client:error-code e)
|
||||
(gemini-client:error-description e)
|
||||
""
|
||||
url))
|
||||
(error (e)
|
||||
(error (_ "Error getting ~s: ~a") url e))
|
||||
(condition (c)
|
||||
|
|
|
@ -3209,6 +3209,7 @@
|
|||
(:json :yason)
|
||||
(:gw :gemini-viewer))
|
||||
(:export
|
||||
:+tofu-error-status-code+
|
||||
:gemini-window
|
||||
:metadata
|
||||
:init-gemini-window
|
||||
|
|
Loading…
Reference in New Issue