3

What type of exception should be thrown when the phone runs out of storage space?

The closest I found is called IsolatedStorageException, but I'm not sure if this is the right one.

turtlesoup
  • 3,188
  • 10
  • 36
  • 50

1 Answers1

0

Your best method is probably just to use an I/O Exception for this. There's actually already a SO Question dealing with how to check if the error generated is that there isn't enough space.

The main takeaway is to check the HResult of the exception to see if it's either ERROR_DISK_FULL (0x70) or ERROR_HANDLE_DISK_FULL (0x27).

Another alternative would to be write a custom exception, overriding IOException, checking the HResult, then throwing the custom exception/handling it accordingly.

Community
  • 1
  • 1
Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36