module Sprockets::ProcessorUtils

def validate_processor_result!(result)

Returns result or raises a TypeError.

result - Metadata Hash returned from call_processors

raise a friendly user error message.
Internal: Validate returned result of calling a processor pipeline and
def validate_processor_result!(result)
  if !result.instance_of?(Hash)
    raise TypeError, "processor metadata result was expected to be a Hash, but was #{result.class}"
  end
  if !result[:data].instance_of?(String)
    raise TypeError, "processor :data was expected to be a String, but as #{result[:data].class}"
  end
  result.each do |key, value|
    if !key.instance_of?(Symbol)
      raise TypeError, "processor metadata[#{key.inspect}] expected to be a Symbol"
    end
    if !valid_processor_metadata_value?(value)
      raise TypeError, "processor metadata[:#{key}] returned a complex type: #{value.inspect}\n" +
        "Only #{VALID_METADATA_TYPES.to_a.join(", ")} maybe used."
    end
  end
  result
end