Calls the specified function block and returns
your value encapsulated in the Result if invocation is successful,
catches any error that is thrown from the block function execution,
then test is called with the error value, if test is true,
the error and the StackTrace are encapsulating it as a failure
in Result, otherwise, if test is false, then the error is rethrow.