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

Coordinator
Oct 4, 2010 at 6: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.

Yury

Coordinator
Oct 7, 2010 at 10: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?

Dirk

 

Coordinator
Oct 8, 2010 at 1: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
Coordinator
Oct 8, 2010 at 3:05 PM

Hi,

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

regards
Dirk

Coordinator
Oct 8, 2010 at 3:08 PM

Hi,

I added an issue for this: http://sharpbox.codeplex.com/workitem/14413

Let us move the discussion to this section :-)

Dirk

 

Coordinator
Oct 8, 2010 at 3:45 PM
Edited Oct 8, 2010 at 3:45 PM
dei79 wrote:

Hi,

I added an issue for this: http://sharpbox.codeplex.com/workitem/14413

Let us move the discussion to this section :-)

Dirk

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