mirror of https://codeberg.org/cage/tinmop/
- prevented program freeze quen a kami error occurred.
This commit is contained in:
parent
8e5c2bb91a
commit
433f7fdaa5
|
@ -2696,6 +2696,20 @@ printed, on the main window."
|
||||||
(avatar-url (db:row-avatar account)))
|
(avatar-url (db:row-avatar account)))
|
||||||
(open-attach-window:open-attachment avatar-url)))
|
(open-attach-window:open-attachment avatar-url)))
|
||||||
|
|
||||||
|
(defmacro with-notify-kami-error (&body body)
|
||||||
|
`(handler-bind ((purgatory:9p-error
|
||||||
|
(lambda (e)
|
||||||
|
(ui:notify (format nil (_ "Error: ~a") e)
|
||||||
|
:life (* (swconf:config-notification-life) 5)
|
||||||
|
:as-error t)
|
||||||
|
(invoke-restart 'purgatory:ignore-error e)))
|
||||||
|
(error
|
||||||
|
(lambda (e)
|
||||||
|
(ui:notify (format nil (_ "Error: ~a") e)
|
||||||
|
:life (* (swconf:config-notification-life) 5)
|
||||||
|
:as-error t))))
|
||||||
|
,@body))
|
||||||
|
|
||||||
(defun open-file-explorer (&optional (root "/"))
|
(defun open-file-explorer (&optional (root "/"))
|
||||||
(with-enqueued-process ()
|
(with-enqueued-process ()
|
||||||
(let ((actual-root (fs:prepend-pwd root)))
|
(let ((actual-root (fs:prepend-pwd root)))
|
||||||
|
@ -2704,7 +2718,7 @@ printed, on the main window."
|
||||||
|
|
||||||
(defun open-kami-address (url)
|
(defun open-kami-address (url)
|
||||||
(with-enqueued-process ()
|
(with-enqueued-process ()
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(let ((handlers (kami:iri->filesystem-window-handlers url)))
|
(let ((handlers (kami:iri->filesystem-window-handlers url)))
|
||||||
(if handlers
|
(if handlers
|
||||||
(let* ((path (uri:path (iri:iri-parse url)))
|
(let* ((path (uri:path (iri:iri-parse url)))
|
||||||
|
@ -2745,7 +2759,7 @@ printed, on the main window."
|
||||||
(when y-pressed-p
|
(when y-pressed-p
|
||||||
(info-message (format nil (_"deleting ~a") path))
|
(info-message (format nil (_"deleting ~a") path))
|
||||||
(with-enqueued-process ()
|
(with-enqueued-process ()
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:delete-treenode win path)))))))
|
(fstree:delete-treenode win path)))))))
|
||||||
(ask-string-input #'on-input-complete
|
(ask-string-input #'on-input-complete
|
||||||
:prompt
|
:prompt
|
||||||
|
@ -2759,7 +2773,7 @@ printed, on the main window."
|
||||||
(flet ((on-input-complete (new-path)
|
(flet ((on-input-complete (new-path)
|
||||||
(when (string-not-empty-p new-path)
|
(when (string-not-empty-p new-path)
|
||||||
(with-enqueued-process ()
|
(with-enqueued-process ()
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:rename-treenode win path new-path))))))
|
(fstree:rename-treenode win path new-path))))))
|
||||||
(ask-string-input #'on-input-complete
|
(ask-string-input #'on-input-complete
|
||||||
:prompt
|
:prompt
|
||||||
|
@ -2772,7 +2786,7 @@ printed, on the main window."
|
||||||
"Download a file"
|
"Download a file"
|
||||||
(when-let* ((win *filesystem-explorer-window*))
|
(when-let* ((win *filesystem-explorer-window*))
|
||||||
(labels ((%download (win path destination-file)
|
(labels ((%download (win path destination-file)
|
||||||
(with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:download-path win path destination-file)))
|
(fstree:download-path win path destination-file)))
|
||||||
(on-input-complete (destination-file)
|
(on-input-complete (destination-file)
|
||||||
(when (string-not-empty-p destination-file)
|
(when (string-not-empty-p destination-file)
|
||||||
|
@ -2829,7 +2843,7 @@ Note: existing file will be overwritten."
|
||||||
(_"downloading ~a → ~a")
|
(_"downloading ~a → ~a")
|
||||||
remote-file
|
remote-file
|
||||||
local-file))
|
local-file))
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:download-path win
|
(fstree:download-path win
|
||||||
remote-file
|
remote-file
|
||||||
local-file))))
|
local-file))))
|
||||||
|
@ -2879,7 +2893,7 @@ Note: existing file will be overwritten."
|
||||||
(_"downloading ~a → ~a")
|
(_"downloading ~a → ~a")
|
||||||
source
|
source
|
||||||
destination))
|
destination))
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:upload-path win
|
(fstree:upload-path win
|
||||||
source
|
source
|
||||||
destination))))
|
destination))))
|
||||||
|
@ -2900,7 +2914,7 @@ Note: existing file will be overwritten."
|
||||||
(when (string-not-empty-p new-path)
|
(when (string-not-empty-p new-path)
|
||||||
(with-enqueued-process ()
|
(with-enqueued-process ()
|
||||||
(let ((dirp (fs:extension-dir-p new-path)))
|
(let ((dirp (fs:extension-dir-p new-path)))
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:create-treenode win new-path dirp)))))))
|
(fstree:create-treenode win new-path dirp)))))))
|
||||||
(ask-string-input #'on-input-complete
|
(ask-string-input #'on-input-complete
|
||||||
:prompt (_ "Create: ")
|
:prompt (_ "Create: ")
|
||||||
|
@ -3027,7 +3041,7 @@ if the selected item represents a directory."
|
||||||
(when-let* ((win *filesystem-explorer-window*)
|
(when-let* ((win *filesystem-explorer-window*)
|
||||||
(fields (line-oriented-window:selected-row-fields win))
|
(fields (line-oriented-window:selected-row-fields win))
|
||||||
(path (fstree:tree-path fields)))
|
(path (fstree:tree-path fields)))
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:open-node win path))))
|
(fstree:open-node win path))))
|
||||||
|
|
||||||
(defun file-explorer-node-details ()
|
(defun file-explorer-node-details ()
|
||||||
|
@ -3056,7 +3070,7 @@ if the selected item represents a directory."
|
||||||
(let* ((win *filesystem-explorer-window*)
|
(let* ((win *filesystem-explorer-window*)
|
||||||
(fields (line-oriented-window:selected-row-fields win))
|
(fields (line-oriented-window:selected-row-fields win))
|
||||||
(path (fstree:tree-path fields)))
|
(path (fstree:tree-path fields)))
|
||||||
(tui:with-notify-errors
|
(with-notify-kami-error
|
||||||
(fstree:edit-node win path)
|
(fstree:edit-node win path)
|
||||||
(info-message (format nil (_ "File ~s was modified on server") path)))))
|
(info-message (format nil (_ "File ~s was modified on server") path)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue