Sha256: 4c73d4bbbd04c8b3cc5bf7922e8b09b0182046baa60e46885f1b116783931ca9

Contents?: true

Size: 530 Bytes

Versions: 7

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

require_relative 'probe/result'

module HttpHealthCheck
  module Probe
    def call(env)
      with_error_handler { probe(env) }
    end

    def meta
      {}
    end

    def probe_ok(extra_meta = {})
      Result.ok(meta.merge(extra_meta))
    end

    def probe_error(extra_meta = {})
      Result.error(meta.merge(extra_meta))
    end

    def with_error_handler
      yield
    rescue StandardError => e
      probe_error(error_class: e.class.name, error_message: e.message)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
http_health_check-0.5.0 lib/http_health_check/probe.rb
http_health_check-0.4.1 lib/http_health_check/probe.rb
http_health_check-0.4.0 lib/http_health_check/probe.rb
http_health_check-0.3.1 lib/http_health_check/probe.rb
http_health_check-0.3.0 lib/http_health_check/probe.rb
http_health_check-0.2.1 lib/http_health_check/probe.rb
http_health_check-0.2.0 lib/http_health_check/probe.rb