| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Lorentz.Errors.Numeric.Doc
Contents
Description
Autodoc for numeric errors.
Synopsis
- data DDescribeErrorTagMap = DDescribeErrorTagMap {- detmSrcLoc :: Text
 
- applyErrorTagToErrorsDoc :: HasCallStack => ErrorTagMap -> (inp :-> out) -> inp :-> out
- applyErrorTagToErrorsDocWith :: HasCallStack => [NumericErrorDocHandler] -> ErrorTagMap -> (inp :-> out) -> inp :-> out
- data NumericErrorDocHandler
- data NumericErrorDocHandlerError
- customErrorDocHandler :: NumericErrorDocHandler
- voidResultDocHandler :: NumericErrorDocHandler
- baseErrorDocHandlers :: [NumericErrorDocHandler]
- data NumericErrorWrapper (numTag :: Nat) (err :: Type)
Documentation
data DDescribeErrorTagMap Source #
Adds a section which explains error tag mapping.
Constructors
| DDescribeErrorTagMap | |
| Fields 
 | |
Instances
applyErrorTagToErrorsDoc :: HasCallStack => ErrorTagMap -> (inp :-> out) -> inp :-> out Source #
Modify documentation generated for given code so that all CustomError
 mention not their textual error tag rather respective numeric one from the
 given map.
If some documented error is not present in the map, it remains unmodified.
 This function may fail with error if contract uses some uncommon errors,
 see applyErrorTagToErrorsDocWith for details.
applyErrorTagToErrorsDocWith :: HasCallStack => [NumericErrorDocHandler] -> ErrorTagMap -> (inp :-> out) -> inp :-> out Source #
Extended version of applyErrorTagToErrorsDoc which accepts error
 handlers.
In most cases that function should be enough for your purposes, but it uses a fixed set of base handlers which may be not enough in case when you define your own errors. In this case define and pass all the necessary handlers to this function.
It fails with error if some of the errors used in the contract cannot be
 handled with given handlers.
data NumericErrorDocHandler Source #
Handler which changes documentation for one particular error type.
data NumericErrorDocHandlerError Source #
Errors for NumericErrorDocHandler
customErrorDocHandler :: NumericErrorDocHandler Source #
Handler for all CustomErrors.
voidResultDocHandler :: NumericErrorDocHandler Source #
Handler for VoidResult.
baseErrorDocHandlers :: [NumericErrorDocHandler] Source #
Handlers for most common errors defined in Lorentz.
Internals
data NumericErrorWrapper (numTag :: Nat) (err :: Type) Source #
Some error with a numeric tag attached.
Instances
| (ErrorHasDoc err, KnownNat numTag, ErrorHasNumericDoc err) => ErrorHasDoc (NumericErrorWrapper numTag err) Source # | |
| Defined in Lorentz.Errors.Numeric.Doc Associated Types type ErrorRequirements (NumericErrorWrapper numTag err) Source # Methods errorDocName :: Text Source # errorDocMdCause :: Markdown Source # errorDocMdCauseInEntrypoint :: Markdown Source # errorDocHaskellRep :: Markdown Source # errorDocClass :: ErrorClass Source # errorDocDependencies :: [SomeDocDefinitionItem] Source # errorDocRequirements :: Dict (ErrorRequirements (NumericErrorWrapper numTag err)) Source # | |
| type ErrorRequirements (NumericErrorWrapper numTag err) Source # | |
| Defined in Lorentz.Errors.Numeric.Doc | |