EB!5      !"#$%&'()*+,-./01234None555None6"Given something like [(undefined, Success)]", the following will be produced:  data ErrCode  = Success  | Other !DWORD  deriving (Eq, Show) 7869:;69:7869:;None MWin32 actions typically return an error code to indicate success or failure. S These codes are intended to be globally unique, though there may be some overlap. B MSDN documents which errors may be returned by any given action. JThe naming of errors follows a convention. An error such as ERROR_SUCCESS  becomes %, ERROR_FILE_NOT_FOUND becomes $ , and so K on. There are thousands of errors, so it would be impractical to add them  all. The < constructor is used to represent error codes which are not  handled specifically. User'Os of this library are encouraged to submit new error codes. Add new entries to T System.Win32.Errors.Mapping. Send your pull requests along with a link to relevent  documentation to   0https://github.com/mikesteele81/Win32-errors.git0https://github.com/mikesteele81/Win32-errors.git. ' Convert an  into a <. (!Exception type for Win32 errors. LThis type will be thrown as an extensible exception when a foreign call out N to part of the Win32 indicates that an error has occurred. In most cases you , should wrap an IO computation in a call to .. &The following example uses the custom  createFile function described in  System.Win32.Error.Foreign:  eHandle <- do O h <- E.tryWin32 $ createFile "c:\\missing.txt" gENERIC_READ oPEN_EXISTING  -- perform other actions  return h  case eHandle of  Right handle -> do * -- do something with the file handle  Left w32Err -> do  case E.errCode w32Err of  E.InvalidHandle -> do  -- perform cleanup $ -- handle other error codes. ) T.putStrLn $ E.systemMessage w32Err *3The foreign action which triggered this exception. +The error code ,<The standard system message associated with the error code. - Convert a < into an . Values which don' t have a 3 corresponding constructor will end up becoming an . .JActions calling out to Win32 may throw exceptions. Wrapping the action in  . will catch (& exceptions, but will allow any other ! exception type to pass through. =/Performs marshalling by converting to and from <. 1  !"#$%&'()*+,-.>=/  !"#$%&'()*+,-.&&%$#"!  '()*+,-.>=Windows  experimental mikesteele81@gmail.com  Trustworthy/'This function mirrors the Win32 package's   function. 0CCopied from the Win32 package. Use this to throw a Win32 exception @ when an action returns a value satisfying the given predicate. K The exception thrown will depend on a thead-local global error condition.  The supplied ?7 value should be set to the human-friendly name of the " action that triggered the error. 1'This function mirrors the Win32 package's   function. 2)Perform the supplied action, and throw a ( exception if the $ return code is anything other than %. The supplied action returns  a < instead of an * so that foreign imports can be used more  conveniently. 3MWindows maintains a thread-local value representing the previously triggered  error code. Calling 3% will look up the value, and throw a (  exception. The supplied ?4 argument should be set to the name of the function & which triggered the error condition. RCalling this action when no error has occurred (0x00000000 -- ERROR_SUCCESS) will - result in an exception being thrown for the % error code. @:Like failWith, but avoid multiple conversions to and from . 4Throw a (7 exception for the given function name and error code. AThis function doesn'-t belong in Win32-errors, which is why it isn't H exported. FormatMessage is required to get the standard system message  associated with an error code. B/0123@4A/012340/1243 B/0123@4AWindows  experimental mikesteele81@gmail.com  Trustworthy/  !"#$%&'()*+,-./()*+,.'-&%$#"!  C      !"#$%&'()*+,-./01123456789:;<3=>?@ABCDEFGHIJKWin32-errors-0.2System.Win32.ErrorSystem.Win32.Error.ForeignSystem.Win32.Error.MappingSystem.Win32.Error.THSystem.Win32.Error.TypesSystem.Win32.Types failIfFalse_ failIfNullErrCodeOtherDhcpFoIprangeTypeConvIllegalScopeRangePolicyRangeConflictDhcpIprangeConvIllegalDhcpInvalidRangeDhcpReservedipExistsDhcpIprangeExistsDhcpReservedClientDhcpNotReservedClient DhcpJetErrorDhcpOptionNotPresentDhcpElementCantRemoveDhcpSubnetNotPresentNotAReparsePointRPCSServerTooBusyRPCSServerUnavailableServiceNotInExeServiceSpecificErrorExceptionInServiceFailedServiceControllerConnectServiceNotActiveServiceCannotAcceptCtrlServiceDoesNotExistServiceDisabledServiceAlreadyRunning NoMoreItemsMoreDataCallNotImplemented NoMoreFilesCurrentDirectory InvalidDrive InvalidData InvalidHandle AccessDenied PathNotFound FileNotFoundSuccessInvalidHandleValuetoDWORDWin32ExceptionfunctionerrCode systemMessage fromDWORDtryWin32failIffailUnlessSuccesserrorWinfailWithmapping genErrCodeerrOther gentoDWORD genfromDWORDlitDWORD Win32-2.3.0.0DWORD$fStorableErrCode$fExceptionWin32Exception text-0.11.3.1Data.Text.InternalText failWith' formatMessagec_FormatMessage