def halt_error(status, errors, options = {})
      errors_as_json = errors.respond_to?(:as_json) ? errors.as_json : errors
      unless errors_as_json.is_a?(Hash)
        raise ArgumentError, "errors be an object representable in JSON as a Hash; got errors = #{errors.inspect}"
      end
      unless errors_as_json.keys.all? { |k| k.is_a?(String) || k.is_a?(Symbol) }
        raise ArgumentError, "errors keys must all be string or symbol; got errors = #{errors.inspect}"
      end
      unless errors_as_json.values.all? { |v| v.is_a?(Array) && v.all? { |e| e.is_a?(String) } }
        raise ArgumentError, "errors values must all be arrays of strings; got errors = #{errors.inspect}"
      end
      error_message = nil
      halt_options = options.reject do |k,v|
        (k.to_s == 'error_message').tap do |is_error_message|
          if is_error_message
            error_message = v
          end
        end
      end
      body = {'errors' => errors}
      error_message ||= begin
        error_values = errors.values.inject([], &:+)
        if error_values.size <= 1
          error_values.first
        else
          # sentencify with periods 
          error_values.map { |v| v =~ /\.\s*\z/ ? v : v + '.' }.join(' ')
        end
      end
      body['error_message'] = error_message if error_message
      if Object.const_defined?(:Rollbar) and status != 404 and Object.const_defined?(:DEBUG_4XX) and DEBUG_4XX['enabled']
        Rollbar.debug "Service halted with status #{status}", status: status, body: body, halt_options: halt_options
      end
      halt(status, body, halt_options)
    end
def halt_error(status, errors, options = {})
      errors_as_json = errors.respond_to?(:as_json) ? errors.as_json : errors
      unless errors_as_json.is_a?(Hash)
        raise ArgumentError, "errors be an object representable in JSON as a Hash; got errors = #{errors.inspect}"
      end
      unless errors_as_json.keys.all? { |k| k.is_a?(String) || k.is_a?(Symbol) }
        raise ArgumentError, "errors keys must all be string or symbol; got errors = #{errors.inspect}"
      end
      unless errors_as_json.values.all? { |v| v.is_a?(Array) && v.all? { |e| e.is_a?(String) } }
        raise ArgumentError, "errors values must all be arrays of strings; got errors = #{errors.inspect}"
      end
      error_message = nil
      halt_options = options.reject do |k,v|
        (k.to_s == 'error_message').tap do |is_error_message|
          if is_error_message
            error_message = v
          end
        end
      end
      body = {'errors' => errors}
      error_message ||= begin
        error_values = errors.values.inject([], &:+)
        if error_values.size <= 1
          error_values.first
        else
          # sentencify with periods 
          error_values.map { |v| v =~ /\.\s*\z/ ? v : v + '.' }.join(' ')
        end
      end
      body['error_message'] = error_message if error_message
      if Object.const_defined?(:Rollbar) and status != 404 and Object.const_defined?(:DEBUG_4XX) and DEBUG_4XX['enabled']
        Rollbar.debug "Service halted with status #{status}", status: status, body: body, halt_options: halt_options
      end
      halt(status, body, halt_options)
    end
halt and render the given errors in the body on the 'errors' key