mapError


Description:

public Result<T,F> mapError<F> (owned MapFunc<E,F> func)

If this is an error, applies the function to the error and returns a new Result. If this is a success, returns the value unchanged.

Example:

    var r = Result.error<string,string> ("err");
var mapped = r.mapError<string> ((e) => { return e.up (); });
assert (mapped.unwrapError () == "ERR");

Parameters:

func

the error transformation function.

Returns:

a new Result with the transformed error.