System.Security.AccessControl.EventWaitHandleSecurity._HandleErrorCode C# (CSharp) Method

_HandleErrorCode() private method

private _HandleErrorCode ( int errorCode, string name, SafeHandle handle, object context ) : Exception
errorCode int
name string
handle SafeHandle
context object
return System.Exception
        private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
        {
            System.Exception exception = null;

            switch (errorCode)
            {
                case Interop.Errors.ERROR_INVALID_NAME:
                case Interop.Errors.ERROR_INVALID_HANDLE:
                case Interop.Errors.ERROR_FILE_NOT_FOUND:
                    if ((name != null) && (name.Length != 0))
                        exception = new WaitHandleCannotBeOpenedException(SR.Format(SR.WaitHandleCannotBeOpenedException_InvalidHandle, name));
                    else
                        exception = new WaitHandleCannotBeOpenedException();
                    break;

                default:
                    break;
            }

            return exception;
        }