Skip to main content

Any.map_error

map_errorf

Documentation

Transforms an error.

If self is a non-error value it is returned unchanged. However, if self is an error, the error is transformed using the provided function.

Arguments

  • f: The function used to transform the error.

Examples

Transforming an error value to provide more information.

      from Standard.Base import all
from Standard.Examples import Example_Error_Type

example_map_error =
my_dictionary = Dictionary.empty
error = my_dictionary.at "x"
error.map_error (_ -> Example_Error_Type "x is missing")