Use switch

This commit is contained in:
Dean Herbert
2019-07-30 13:31:57 +09:00
parent 370a81d78a
commit 6f91a21f00

View File

@ -37,24 +37,27 @@ namespace osu.Game.Utils
if (exception != null) if (exception != null)
{ {
if (exception is IOException ioe) switch (exception)
{ {
// disk full exceptions, see https://stackoverflow.com/a/9294382 case IOException ioe:
const int hr_error_handle_disk_full = unchecked((int)0x80070027); // disk full exceptions, see https://stackoverflow.com/a/9294382
const int hr_error_disk_full = unchecked((int)0x80070070); const int hr_error_handle_disk_full = unchecked((int)0x80070027);
const int hr_error_disk_full = unchecked((int)0x80070070);
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
return;
}
if (exception is WebException we)
{
switch (we.Status)
{
// more statuses may need to be blocked as we come across them.
case WebExceptionStatus.Timeout:
return; return;
}
break;
case WebException we:
switch (we.Status)
{
// more statuses may need to be blocked as we come across them.
case WebExceptionStatus.Timeout:
return;
}
break;
} }
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.