api-tools-0.9.0.0: DSL for generating API boilerplate and docs
Safe HaskellNone
LanguageHaskell2010

Data.API.Error

Synopsis

Representation of JSON parsing errors

type JSONWarning = JSONError Source #

At present, we do not distinguish between errors and warnings

data Expected Source #

JSON type expected at a particular position, when a value of a different type was encountered

Instances

Instances details
Eq Expected Source # 
Instance details

Defined in Data.API.Error

Show Expected Source # 
Instance details

Defined in Data.API.Error

ToJSON Expected Source # 
Instance details

Defined in Data.API.Error

FromJSON Expected Source # 
Instance details

Defined in Data.API.Error

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).

data Step Source #

Each step may be into a field of an object, or a specific element of an array.

Constructors

InField Text 
InElem Int 

Instances

Instances details
Eq Step Source # 
Instance details

Defined in Data.API.Error

Methods

(==) :: Step -> Step -> Bool #

(/=) :: Step -> Step -> Bool #

Show Step Source # 
Instance details

Defined in Data.API.Error

Methods

showsPrec :: Int -> Step -> ShowS #

show :: Step -> String #

showList :: [Step] -> ShowS #

ToJSON Step Source # 
Instance details

Defined in Data.API.Error

FromJSON Step Source # 
Instance details

Defined in Data.API.Error

SafeCopy Step Source # 
Instance details

Defined in Data.API.Error

PPLines Step Source # 
Instance details

Defined in Data.API.Error

Methods

ppLines :: Step -> [String] Source #

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

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

Instances details
Eq ValueError Source # 
Instance details

Defined in Data.API.Error

Show ValueError Source # 
Instance details

Defined in Data.API.Error

PPLines ValueError Source # 
Instance details

Defined in Data.API.Error

data ValidateFailure Source #

Errors that may be discovered when validating a changelog

Constructors

ChangelogOutOfOrder

the changelog must be in descending order of versions

CannotDowngrade

forbid migrating from one version to an earlier version

ApiInvalid

an API uses types that are not declared

ChangelogEntryInvalid

changelog entry does not apply

ChangelogIncomplete

changelog is incomplete (ie all entries apply ok but result isn't the target api)

Instances

Instances details
Eq ValidateFailure Source # 
Instance details

Defined in Data.API.Error

Show ValidateFailure Source # 
Instance details

Defined in Data.API.Error

PPLines ValidateFailure Source # 
Instance details

Defined in Data.API.Error

data ValidateWarning Source #

Instances

Instances details
Show ValidateWarning Source # 
Instance details

Defined in Data.API.Error

data ApplyFailure Source #

Errors that may occur applying a single API change

Constructors

TypeExists

for adding or renaming type

TypeDoesNotExist

for deleting or renaming a type

TypeWrongKind

e.g. it's not a record type

TypeInUse

cannot delete/modify types that are still used

Fields

TypeMalformed

type refers to a non-existent type

DeclMalformed

decl refers to a non-existent type

FieldExists

for adding or renaming a field

FieldDoesNotExist

for deleting or renaming a field

FieldBadDefaultValue

for adding a field, must be a default value compatible with the type

DefaultMissing

for adding a field to a table

TableChangeError

custom error in tableChange

Instances

Instances details
Eq ApplyFailure Source # 
Instance details

Defined in Data.API.Error

Show ApplyFailure Source # 
Instance details

Defined in Data.API.Error

PPLines ApplyFailure Source # 
Instance details

Defined in Data.API.Error

data TypeKind Source #

Instances

Instances details
Eq TypeKind Source # 
Instance details

Defined in Data.API.Error

Show TypeKind Source # 
Instance details

Defined in Data.API.Error

PP TypeKind Source # 
Instance details

Defined in Data.API.Error

Methods

pp :: TypeKind -> String Source #