Codec.JSON.DecodeError
- Package
- purescript-codec-json
- Repository
- garyb/purescript-codec-json
#DecodeError Source
newtype DecodeErrorType for failures while decoding, a path to the point in the JSON that failure occurred, a message describing the problem, and a list of further causes for the failure.
Constructors
Instances
#DecodeErrorDetails Source
type DecodeErrorDetails = { causes :: Array DecodeError, message :: String, path :: Path }#print Source
print :: DecodeError -> StringPrints an DecodeError as a somewhat readable error message.
#withPath Source
withPath :: (Path -> Path) -> DecodeError -> DecodeErrorUpdates the path for an error. The transformation is applied to the error itself along with its causes, recursively. This is intended for extending the path to elaborate on the location of errors from the top down.
#withContext Source
withContext :: String -> DecodeError -> DecodeErrorStarts a new context for the error, pushing the current error into causes and providing a
new message. This is useful for cases where you want to introduce a higher level error, adding
information about domain types, for example.
#error Source
error :: Path -> String -> DecodeErrorConstructs an error from a path and message (no further causes).
#basic Source
basic :: String -> DecodeErrorConstructs a basic error from just a message.
#noValueFound Source
noValueFound :: Path -> DecodeErrorConstructs an error with the message "No value found" and the specified path.