Added the options to change behavior on failure.

adding named argument `fail_with` (either a function or a value) allows
to specify how failure to comply with conditions should proceed.