Callback to map a result or an exception to a specific type and/or perform additional operations (e.g., logging, throwing an exception).