validate_span!

in spec/support/intercept.rb [52:71]


    def validate_span!(span)
      type, subtype = [span.type, span.subtype]

      begin
        info = @span_types.fetch(type)
      rescue KeyError
        raise "Unknown span.type `#{type}'\nPossible types: #{@span_types.keys.join(', ')}"
      end

      return unless (allowed_subtypes = info['subtypes'])

      if !info['allow_null_subtype'] && !subtype
        raise "span.subtype missing when required,\nPossible subtypes: #{allowed_subtypes}"
      end

      allowed_subtypes.fetch(subtype) unless info['allow_unlisted_subtype']
    rescue KeyError
      raise "Unknown span.subtype `#{span.type}'\nPossible subtypes: #{allowed_subtypes}"
    end