alloy_sol_types

Function decode_revert_reason

Source
pub fn decode_revert_reason(out: &[u8]) -> Option<String>
Expand description

Decodes and retrieves the reason for a revert from the provided output data.

This function attempts to decode the provided output data as a generic contract error or a UTF-8 string (for Vyper reverts) using the RevertReason::decode method.

If successful, it returns the decoded revert reason wrapped in an Option.

If both attempts fail, it returns None.