| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.API.Error
Synopsis
- data JSONError
- type JSONWarning = JSONError
- data Expected
- data FormatExpected
- type Position = [Step]
- data Step
- inField :: FieldName -> Step
- prettyJSONErrorPositions :: [(JSONError, Position)] -> String
- prettyJSONError :: JSONError -> String
- prettyStep :: Step -> String
- expectedArray :: Value -> JSONError
- expectedBool :: Value -> JSONError
- expectedInt :: Value -> JSONError
- expectedObject :: Value -> JSONError
- expectedString :: Value -> JSONError
- badFormat :: String -> Text -> JSONError
- data ValueError
- data ValidateFailure
- = ChangelogOutOfOrder { }
- | CannotDowngrade { }
- | ApiInvalid { }
- | ChangelogEntryInvalid { }
- | ChangelogIncomplete { }
- data ValidateWarning
- data ApplyFailure
- = TypeExists { }
- | TypeDoesNotExist { }
- | TypeWrongKind { }
- | TypeInUse { }
- | TypeMalformed { }
- | DeclMalformed { }
- | FieldExists { }
- | FieldDoesNotExist { }
- | FieldBadDefaultValue { }
- | DefaultMissing { }
- | TableChangeError { }
- data TypeKind
- data MigrateFailure
- type MigrateWarning = ValidateWarning
- prettyMigrateFailure :: MigrateFailure -> String
- prettyValidateFailure :: ValidateFailure -> String
- prettyValueError :: ValueError -> String
- prettyValueErrorPosition :: (ValueError, Position) -> String
Representation of JSON parsing errors
Represents an error that can be encountered while parsing
Constructors
type JSONWarning = JSONError Source #
At present, we do not distinguish between errors and warnings
JSON type expected at a particular position, when a value of a different type was encountered
data FormatExpected Source #
Special format expected of a string
Instances
| Eq FormatExpected Source # | |
Defined in Data.API.Error Methods (==) :: FormatExpected -> FormatExpected -> Bool # (/=) :: FormatExpected -> FormatExpected -> Bool # | |
| Show FormatExpected Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> FormatExpected -> ShowS # show :: FormatExpected -> String # showList :: [FormatExpected] -> ShowS # | |
| ToJSON FormatExpected Source # | |
Defined in Data.API.Error Methods toJSON :: FormatExpected -> Value # toEncoding :: FormatExpected -> Encoding # toJSONList :: [FormatExpected] -> Value # toEncodingList :: [FormatExpected] -> Encoding # | |
| FromJSON FormatExpected Source # | |
Defined in Data.API.Error Methods parseJSON :: Value -> Parser FormatExpected # parseJSONList :: Value -> Parser [FormatExpected] # | |
type Position = [Step] Source #
A position inside a JSON value is a list of steps, ordered innermost first (so going inside an object prepends a step).
Each step may be into a field of an object, or a specific element of an array.
prettyJSONErrorPositions :: [(JSONError, Position)] -> String Source #
Human-readable presentation of a list of parse errors with their positions
prettyJSONError :: JSONError -> String Source #
Human-readable description of a JSON parse error
prettyStep :: Step -> String Source #
Human-readable description of a single step in a position
JSON parse error construction
expectedArray :: Value -> JSONError Source #
expectedBool :: Value -> JSONError Source #
expectedInt :: Value -> JSONError Source #
expectedObject :: Value -> JSONError Source #
expectedString :: Value -> JSONError Source #
Validation and migration errors
data ValueError Source #
Errors that can be discovered when migrating data values
Constructors
| JSONError JSONError | Data doesn't match schema |
| CustomMigrationError String Value | Error generated during custom migration |
| InvalidAPI ApplyFailure | An API change was invalid |
Instances
| Eq ValueError Source # | |
Defined in Data.API.Error | |
| Show ValueError Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> ValueError -> ShowS # show :: ValueError -> String # showList :: [ValueError] -> ShowS # | |
| PPLines ValueError Source # | |
Defined in Data.API.Error Methods ppLines :: ValueError -> [String] Source # | |
data ValidateFailure Source #
Errors that may be discovered when validating a changelog
Constructors
| ChangelogOutOfOrder | the changelog must be in descending order of versions |
Fields | |
| CannotDowngrade | forbid migrating from one version to an earlier version |
Fields | |
| ApiInvalid | an API uses types that are not declared |
Fields | |
| ChangelogEntryInvalid | changelog entry does not apply |
Fields | |
| ChangelogIncomplete | changelog is incomplete (ie all entries apply ok but result isn't the target api) |
Instances
| Eq ValidateFailure Source # | |
Defined in Data.API.Error Methods (==) :: ValidateFailure -> ValidateFailure -> Bool # (/=) :: ValidateFailure -> ValidateFailure -> Bool # | |
| Show ValidateFailure Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> ValidateFailure -> ShowS # show :: ValidateFailure -> String # showList :: [ValidateFailure] -> ShowS # | |
| PPLines ValidateFailure Source # | |
Defined in Data.API.Error Methods ppLines :: ValidateFailure -> [String] Source # | |
data ValidateWarning Source #
Instances
| Show ValidateWarning Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> ValidateWarning -> ShowS # show :: ValidateWarning -> String # showList :: [ValidateWarning] -> ShowS # | |
data ApplyFailure Source #
Errors that may occur applying a single API change
Constructors
| TypeExists | for adding or renaming type |
Fields | |
| TypeDoesNotExist | for deleting or renaming a type |
Fields | |
| TypeWrongKind | e.g. it's not a record type |
Fields | |
| TypeInUse | cannot delete/modify types that are still used |
Fields | |
| TypeMalformed | type refers to a non-existent type |
Fields
| |
| DeclMalformed | decl refers to a non-existent type |
Fields | |
| FieldExists | for adding or renaming a field |
Fields | |
| FieldDoesNotExist | for deleting or renaming a field |
Fields | |
| FieldBadDefaultValue | for adding a field, must be a default value compatible with the type |
Fields | |
| DefaultMissing | for adding a field to a table |
Fields | |
| TableChangeError | custom error in tableChange |
Fields | |
Instances
| Eq ApplyFailure Source # | |
Defined in Data.API.Error | |
| Show ApplyFailure Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> ApplyFailure -> ShowS # show :: ApplyFailure -> String # showList :: [ApplyFailure] -> ShowS # | |
| PPLines ApplyFailure Source # | |
Defined in Data.API.Error Methods ppLines :: ApplyFailure -> [String] Source # | |
Constructors
| TKRecord | |
| TKUnion | |
| TKEnum | |
| TKNewtype | |
| TKTypeSynonym |
data MigrateFailure Source #
Constructors
| ValidateFailure ValidateFailure | |
| ValueError ValueError Position |
Instances
| Eq MigrateFailure Source # | |
Defined in Data.API.Error Methods (==) :: MigrateFailure -> MigrateFailure -> Bool # (/=) :: MigrateFailure -> MigrateFailure -> Bool # | |
| Show MigrateFailure Source # | |
Defined in Data.API.Error Methods showsPrec :: Int -> MigrateFailure -> ShowS # show :: MigrateFailure -> String # showList :: [MigrateFailure] -> ShowS # | |
| PPLines MigrateFailure Source # | |
Defined in Data.API.Error Methods ppLines :: MigrateFailure -> [String] Source # | |
type MigrateWarning = ValidateWarning Source #
prettyValueError :: ValueError -> String Source #
prettyValueErrorPosition :: (ValueError, Position) -> String Source #