def and_then
      promise = Promise.new(@options)
      on_complete do |try|
        Fear.try do
          Fear::Try.matcher { |m| yield(m) }.call_or_else(try, &:itself)
        end
        promise.complete!(try)
      end

      promise.to_future
    end
def and_then
      promise = Promise.new(@options)
      on_complete do |try|
        Fear.try do
          Fear::Try.matcher { |m| yield(m) }.call_or_else(try, &:itself)
        end
        promise.complete!(try)
      end

      promise.to_future
    end
rubocop: enable Metrics/MethodLength
 Applies the side-effecting block to the result of +self+ future,
 and returns a new future with the result of this future.

 This method allows one to enforce that the callbacks are executed in a
 specified order.

 @note that if one of the chained +and_then+ callbacks throws
 an error, that error is not propagated to the subsequent
 +and_then+ callbacks. Instead, the subsequent +and_then+ callbacks
 are given the original value of this future.

 @example The following example prints out +5+:
   f = Fear.future { 5 }
   f.and_then do
     m.success { }fail| 'runtime error' }
   end.and_then do |m|
     m.success { |value| puts value } # it evaluates this branch
     m.failure { |error| puts error.massage }
   end