karelia / ConnectionKit

FTP/SFTP/WebDAV etc. for Cocoa. Join the ConnectionKit mailing list for information and suggestions.
http://lists.opensource.utr-software.com/listinfo.cgi/connection-opensource.utr-software.com
493 stars 72 forks source link

Open Panel error-handling #55

Closed mikeabdullah closed 10 years ago

mikeabdullah commented 11 years ago

Having a fresh play here with CK2OpenPanel, I'm a bit worried about error-handling.

In my code, I call -setDirectoryURL:completionHandler: and show the panel. If the completion handler reports a failure, I camel the panel, and present the error in its place. That handles the common case.

But what about errors mid-browsing? Say, the user's internet connection goes down. I see no feedback mechanism for the open panel to report that to its delegate at present. In such circumstances, I can think of a few approaches that could be taken:

  1. Quietly fail loading and go back to the previously visible directory
  2. Close the panel and have client deal with the error as they see fit
  3. Present the error above the panel in some fashion; acknowledging the error cancels the panel
  4. Present the error above the panel in some fashion; acknowledging returns the panel to its previous directory

In both 3 and 4 above, could potentially include a "Retry" button to the user to help them cope with temporary issues.

Presently, I think we take option 1 which is probably the worst of the bunch. Can we do better?

MrNoodle commented 11 years ago

Not sure if I follow. Currently, you'll see an error in place of the file listing when the user clicks on a directory and they can click the reload button to try again. I guess it's not clear which case you are referring to where no error is shown.

mikeabdullah commented 11 years ago

Well I'm a bit of an idiot. Clean forgot that you'd made errors show up inline as part of the browser! In which case the current behaviour suits me fine. It might be worth offering the delegate a hook to customise error handling, but I have no need for that right now, so think it best to leave as-is.