This project is read-only.

DropBoxStorageProvider.Open(...) modify to return failure reason

Oct 4, 2010 at 7:49 AM

Currently DropBoxStorageProvider.Open() method returns bool. If connection fails, it's impossible know what was the reason.

For a GUI application this approach is not practical. For example, I want to know, if the Open failed due to the invalid login credentials or because there is no network connection.

Currently I've to present the end user with a window that say that the attempt to establish connection has failed due to either a network problem or invalid login credentials. Which is not very nice to say at least :)


I propose that the return value of the method to be changed to void. It should raise appropriate exception if it fails to establish connection.


Oct 7, 2010 at 11:02 PM

Hi Yury,

sorry for this late reply but I was on a trade show for my company. I think moving error handling to .NET Exceptions are a great idea. Let us work in the discussion on the exceptions we see. In my opinion the following are a good choice:

- Base Exeception

  - SharpBoxException

- Specific

  - SharpBoxInvalidUserOrPasswordException

  - SharpBoxNetworkException (couldn't not contact storage server, invalid rest message syntax, ...)

 What kind of execeptions do you see?



Oct 8, 2010 at 2:39 AM

Hi Dirk,
having SharpBoxException for SharpBox specific problems sounds like a good idea.

I don't think there is any need to introduce SharpBoxInvalidUserOrPasswordException, instead I would have used the standard System.UnauthorizedAccessException.

Actually with regards of "specific" exceptions...those could be overkill. Take a look on how exceptions implemented in the WMI (System.Management namespace).
Basically there is only one System.Management.ManagementException only. I our case this could be SharpBoxException.

In case of ManagementException, they use different error codes for different error reason. In our case those could be:

  • Couldn't contact storage server
  • Invalid file or directory name
  • File not found
  • Access denied perhaps? This could be used instead of System.UnauthorizedAccessException
Oct 8, 2010 at 4:05 PM


I implemented an early draft in the main branch of Exception support. Would you be so kind to have a look on this?


Oct 8, 2010 at 4:08 PM


I added an issue for this:

Let us move the discussion to this section :-)



Oct 8, 2010 at 4:45 PM
Edited Oct 8, 2010 at 4:45 PM
dei79 wrote:


I added an issue for this:

Let us move the discussion to this section :-)


Sure. I'll review it during the weekend. It's 11.45pm in Singapore already :)