intrepidshape/elm-web3-ui/2.1.2

NOTE: the latest version is 4.0.0

Web3.Ui.Revert

Human-readable revert reasons. elm-web3 can decode Error(string) revert data (Web3.Abi.Decode.decodeRevertReason) — this module is the missing last mile that actually shows it to the user instead of a raw 0x08c379a0… blob.

case model.txError of
    Just raw ->
        Revert.banner [] { onDismiss = Just DismissError } raw


    Nothing ->
        Html.text ""

Decoding is best-effort and honest about it: a decodable Error(string) payload renders its message; anything else (custom solc errors, empty reverts, out-of-gas) renders a labelled fallback with the truncated selector so the information is preserved, never invented.

CSS classes: web3-revert, web3-revert--decoded, web3-revert--raw, web3-revert__reason, web3-revert__dismiss, web3-revert-toast.

List (Attribute msg)
-> { onDismiss : Maybe msg }
-> String
-> Html msg

The same content shaped for a toast/notification stack.

reason : String -> Result String String

Extract the best human-readable string from raw revert data. Ok message when it decoded as Error(string); Err shortForm (a truncated hex selector, or the raw input for non-hex strings) when it did not.