 ;; * Async API.
 ;; * Auto throughput adjusting.
 
+;;;; API - exceptions
+
+(def ^:const ex "DynamoDB API exceptions. 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})
+
 ;;;; Coercion - values
+
+;; TODO Consider alternative approaches to freezing that would _not_ serialize
+;; unwrapped binary data; this is too presumptuous.
 
 (deftype Frozen [value])
 (defn freeze [x] (Frozen. x))

  QueryResult         (as-map [r] (am-query|scan-result r))
  ScanResult          (as-map [r] (am-query|scan-result r))

  CreateTableResult   (as-map [r]) ; TODO
  UpdateTableResult   (as-map [r]) ; TODO
  DeleteTableResult   (as-map [r]) ; TODO

  BatchGetItemResult
  (as-map [r]

       (.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

