   (let [[range options] (extract-range range-and-options)]
     (as-map
      (.query (db-client creds)
-       (query-request table hash-key range options)))))
-
-;;;; API - exceptions
-
-(def ^:const ex "Use #=(ex _) for `try` blocks, etc."
-  {:conditional-check-failed            ConditionalCheckFailedException
-   :internal-server-error               InternalServerErrorException
-   :item-collection-size-limit-exceeded ItemCollectionSizeLimitExceededException
-   :limit-exceeded                      LimitExceededException
-   :provisioned-throughput-exceeded     ProvisionedThroughputExceededException
-   :resource-in-use                     ResourceInUseException
-   :resource-not-found                  ResourceNotFoundException})
+       (query-request table hash-key range options)))))
  [creds {table-name :name
          :keys [throughput hash-key range-key indexes]
          :or   {throughput {:read 1 :write 1}}}]
  (.createTable (db-client creds)
   (let [attr-defs (->> (conj [] hash-key range-key)
                        (concat (map :range-key indexes))
                        (filter identity))]
     (doto (CreateTableRequest.)
       (.setTableName (name table-name))
       (.setKeySchema (key-schema hash-key range-key))
       (.setAttributeDefinitions  (attribute-definitions attr-defs))
       (.setProvisionedThroughput (provisioned-throughput throughput))
       (.setLocalSecondaryIndexes (local-indexes hash-key indexes))))))

(defn describe-table
  "Returns a map describing a table, or nil if the table doesn't exist."
  [creds table]
  (try (as-map (.describeTable (db-client creds)
                (doto (DescribeTableRequest.) (.setTableName (name table)))))
       (catch ResourceNotFoundException _ nil)))

(defn ensure-table "Creates a table iff it doesn't already exist."
  [creds {table-name :name :as opts}]

       (.setAttributeUpdates nil) ; TODO
       (.setExpected         (expected-values expected))
       (.setReturnValues     (utils/enum return))))))

(defn delete-item
  "Deletes an item from a table by its hash key, {attr match-value}.
  See `put-item` for option docs."
  [creds table hash-key & [{:keys [return expected]
                            :or   {return :none}}]]
  (as-map
   (.deleteItem (db-client creds)
     (doto (DeleteItemRequest.)
       (.setTableName    (name table))
       (.setKey          (clj-item->db-item hash-key))
       (.setExpected     (expected-values expected))
       (.setReturnValues (utils/enum return))))))

;;;; TODO Continue code walk-through below

