Safe HaskellNone



Implementation of the Ganeti error types.

This module implements our error hierarchy. Currently we implement one identical to the Python one; later we might one to have separate ones for frontend (clients), master and backend code.



errorCodeFromRaw :: forall m. Monad m => String -> m ErrorCodeSource

data GanetiException Source


GenericError String 
LockError String 
PidFileLockError String 
HypervisorError String 
ProgrammerError String 
BlockDeviceError String 
ConfigurationError String 
ConfigVerifyError String [String] 
ConfigVersionMismatch Int Int 
ReservationError String 
RemoteError String 
SignatureError String 
ParameterError String 
ResultValidationError String 
OpPrereqError String ErrorCode 
OpExecError String 
OpResultError String 
OpCodeUnknown String 
JobLost String 
JobFileCorrupted String 
ResolverError String Int String 
HooksFailure String 
HooksAbort [(String, String, String)] 
UnitParseError String 
ParseError String 
TypeEnforcementError String 
X509CertError String String 
TagError String 
CommandError String 
StorageError String 
InotifyError String 
JobQueueError String 
JobQueueDrainError String 
ConfdMagicError String 
ConfdClientError String 
UdpDataSizeError String 
NoCtypesError String 
IPAddressError String 
LuxiError String 
QueryFilterParseError String 
RapiTestResult String 
FileStoragePathError String 

type ErrorResult = GenericResult GanetiExceptionSource

Error monad using GanetiException type alias.

errorExitCode :: GanetiException -> ExitCodeSource

Returns the exit code of a program that should be used if we got back an exception from masterd.

formatError :: GanetiException -> StringSource

Formats an exception.

type ResultG = ResultT GanetiException IOSource

A type for IO actions with errors properly handled as GanetiExceptions. TODO: Move to Errors.hs

errToResult :: ErrorResult a -> Result aSource

Convert from an ErrorResult to a standard Result.

maybeToError :: String -> Maybe a -> ErrorResult aSource

Convert from a Maybe to a an ErrorResult.