   (when-let [delay-ms (calculate-delay throttler keyy)]
     (let [message (format "Too many attempts! You must wait %d seconds before trying again." (int (math/round (/ delay-ms 1000))))]
       (throw (ex-info message {:status-code 400
-                               :errors      {field-name message}}))))
+                               :errors      {exception-field-key message}}))))
   (swap! attempts conj [keyy (System/currentTimeMillis)]))
 
 

     (defendpoint POST [:as {{:keys [email]} :body}]
       (throttle/check email-throttler email)
       ...)"
  [^Throttler {:keys [attempts field-name], :as throttler} keyy]
  {:pre [(or (= (type throttler) Throttler)
             (println "THROTTLER IS: " (type throttler)))
         keyy]}


(defrecord Throttler [;; Name of the API field/value being checked. Used to generate appropriate API error messages, so they'll be displayed in the
                      ;; right part of the screen
                      ^Keyword exception-field-key
                      ;; [Internal] List of attempt entries. These are pairs of [key timestamp (ms)], e.g. ["cam@metabase.com" 1438045261132]
                      ^Atom    attempts
                      ;; Amount of time to keep an entry in ATTEMPTS before dropping it.
