Ignore:
Timestamp:
1/27/2010 5:58:28 AM (4 years ago)
Author:
lowjoel
Message:

Replace all Marshal.GetExceptionForHR with Win32ErrorCode.GetExceptionForWin32Error since we deal with Win32 errors not unlike COM errors, except with a few exceptions and that we should be throwing Win32Exception instead of COMException.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/CodeReview/Eraser.Util/Win32ErrorCodes.cs

    r1701 r1705  
    2525using System.Runtime.InteropServices; 
    2626using System.IO; 
     27using System.ComponentModel; 
    2728 
    2829namespace Eraser.Util 
     
    5354                case NoError:           return null; 
    5455                case SharingViolation:  return new IOException(); 
     56            } 
    5557 
    56                 default: 
    57                     int HR = GetHRForWin32Error(errorCode); 
    58                     return Marshal.GetExceptionForHR(HR); 
    59             } 
     58            int HR = GetHRForWin32Error(errorCode); 
     59            Exception exception = Marshal.GetExceptionForHR(HR); 
     60            if (exception.GetType() == typeof(COMException)) 
     61                throw new Win32Exception(errorCode); 
     62            else 
     63                throw exception; 
    6064        } 
    6165 
Note: See TracChangeset for help on using the changeset viewer.