     (cond
       (is-scalar-field-type? field-type) result
       (is-enum-field-type? field-type) result
-      (is-object-field-type? field-type) (evaluate-selection-set field-type result sub-selection-set nil))))
+      (is-object-field-type? field-type) (evaluate-selection-set field-type result sub-selection-set nil)
+      :else (throw (ex-info (format "Not a valid field type %s." field-type) {:field-type field-type})))))
 
 (defn get-field-entry [object-type object fields]
   (println "get-field-entry: " fields)


(defn execute-query [query]
  (let [selection-set (:selection-set query)
        visitied-fragments nil]
    (evaluate-selection-set :root nil selection-set visitied-fragments)))

(defn execute-definition
  [definition]

  :NOT_NULL)

(def type-map
  {:GraphQLString {:name "String"
                   :kind :SCALAR}
   :UserType {:name "User"
              :kind :OBJECT
              :fields {:id {:type :GraphQLString}
                       :name {:type :GraphQLString}}
              :args {}
              :resolve-fn (fn [object]
                            (println "user resolve-fn: ")
                            {:id "test"})}})

(def schema
  {:query {:name "Query"
           :kind :OBJECT
           :fields {:user {:type :UserType}}
           :resolve-fn (fn [obj]
                         (println "query resolve-fn:" obj)
                         (identity obj))}})

(defn get-type-meta
  [type-key]
  (or (get schema type-key)
      (get type-map type-key)
      (throw (ex-info (format "Unknown object type: %s." type-key)
                      {:type-key type-key}))))

(defn type-system-lookup
  [parent-object-type-key object-name]
  (let [parent-object-type (get-type-meta parent-object-type-key)
        type (or (get-in parent-object-type [:fields (keyword object-name) :type])
                 (throw (ex-info (format "Unknown object name: %s." parent-object-type-key)
                                 {:parent-object-type-key parent-object-type-key
                                  :object-name object-name})))]
    (println "type: " type)
    (if (map? type)
      type
      (get type-map type))))

(defn get-field-type-from-object-type
  "FIXME"
