   (testing "Search with large page_size."
     (let [{:keys [refs]} (search/find-refs :collection {:page_size 100})]
       (is (= collection-count (count refs)))))
-  (testing "page_size less than one."
-    (try
-      (search/find-refs :collection {:page_size 0})
-      (catch clojure.lang.ExceptionInfo e
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-matches #".*page_size must be a number between 1 and 2000.*" body))))))
-  (testing "Negative page_size."
-    (try
-      (search/find-refs :collection {:page_size -1})
-      (catch clojure.lang.ExceptionInfo e
-        (println "OK>..........")
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-matches #".*page_size must be a number between 1 and 2000.*" body))))))
+  (testing "page_size less than zero."
+    (let [resp (search/find-refs :collection {:page_size -1})
+          {:keys [status errors]} resp]
+      (is (= 400 status))
+      (is (re-matches #".*page_size must be a number between 0 and 2000.*" (first errors)))))
   (testing "page_size too large."
-    (try
-      (search/find-refs :collection {:page_size 2001})
-      (catch clojure.lang.ExceptionInfo e
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-matches #".*page_size must be a number between 1 and 2000.*" body))))))
+    (let [resp (search/find-refs :collection {:page_size 2001})
+          {:keys [status errors]} resp]
+      (is (= 400 status))
+      (is (re-matches #".*page_size must be a number between 0 and 2000.*" (first errors)))))
   (testing "Non-numeric page_size"
-    (try
-      (search/find-refs :collection {:page_size "ABC"})
-      (catch clojure.lang.ExceptionInfo e
-        (let [status (get-in (ex-data e) [:object :status])
-              body (get-in (ex-data e) [:object :body])]
-          (is (= 400 status))
-          (is (re-matches #".*page_size must be a number between 1 and 2000.*" body)))))))
+    (let [resp (search/find-refs :collection {:page_size "ABC"})
+          {:keys [status errors]} resp]
+      (is (= 400 status))
+      (is (re-matches #".*page_size must be a number between 0 and 2000.*" (first errors))))))
 
 (deftest search-for-hits
   (create-collections)

    (let [limit (cfg/config-value :paging-depth-limit 1000000)
          page-size 10
          page-num (int (+ (/ limit page-size) 1))]
      (let [res (search/find-refs :collection
                                  {:page_size page-size
                                   :page-num page-num})
            status (:status res)
            errors (:errors res)]
        (is (= 400 status))
        (is (re-matches #"The paging depth \(page_num \* page_size\) of \[\d*?\] exceeds the limit of \d*?.*?" (first errors)))))))

(deftest search-with-page-size
  (create-collections)

        (is (= (map :short-name [col5 col4 col3 col2 col1])
               (map :short-name refs)))))
    (testing "page_num less than one."
      (let [resp (search/find-refs :collection {:provider "PROV1"
                                                :page_size 5
                                                :page_num 0})
            {:keys [status errors]} resp]
        (is (= 400 status))
        (is (re-matches #".*page_num must be a number greater than or equal to 1.*"
                        (first errors)))))
    (testing "Non-numeric page_num."
      (let [resp (search/find-refs :collection {:provider "PROV1"
                                                :page_size 5
                                                :page_num "ABC"})
            {:keys [status errors]} resp]
        (is (= 400 status))
        (is (re-matches #".*page_num must be a number greater than or equal to 1.*"
                        (first errors)))))))
