úÎD A-      !"#$%&'()*+,None---None."Given something like [(undefined, Success)]", the following will be produced:  data ErrCode  = Success  | Other !DWORD  deriving (Eq, Show) /0.123.12/0.123None 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 4. !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 4 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. 5/Performs marshalling by converting to and from 4. )  !"#$%&65'  !"#$%&  !"#$%&65Windows  experimental mikesteele81@gmail.com  Trustworthy''This function mirrors the Win32 package's   function. (CCopied 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 77 value should be set to the human-friendly name of the " action that triggered the error. )'This function mirrors the Win32 package's   function. *)Perform the supplied action, and throw a   exception if the $ return code is anything other than . The supplied action returns  a 4 instead of an * so that foreign imports can be used more  conveniently. +MWindows maintains a thread-local value representing the previously triggered  error code. Calling +% will look up the value, and throw a    exception. The supplied 74 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. 8:Like failWith, but avoid multiple conversions to and from . ,Throw a  7 exception for the given function name and error code. 9This 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. :'()*+8,9'()*+,(')*,+ :'()*+8,9Windows  experimental mikesteele81@gmail.com  Trustworthy'  !"#$%&' !"#$&% ;      !"#$%&'())*+,-./01234+56789:;<=>?@ABCWin32-errors-0.1System.Win32.ErrorSystem.Win32.Error.ForeignSystem.Win32.Error.MappingSystem.Win32.Error.THSystem.Win32.Error.TypesSystem.Win32.Types failIfFalse_ failIfNullErrCodeOtherDhcpInvalidRangeDhcpNotReservedClient DhcpJetErrorDhcpOptionNotPresentDhcpElementCantRemoveDhcpSubnetNotPresentNotAReparsePointServiceNotInExeServiceSpecificErrorExceptionInServiceFailedServiceControllerConnectServiceNotActiveServiceCannotAcceptCtrlServiceDoesNotExistServiceDisabledServiceAlreadyRunning 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