diff --git a/modules/reitit-ring/src/reitit/ring.cljc b/modules/reitit-ring/src/reitit/ring.cljc index 8625cda9..463e911e 100644 --- a/modules/reitit-ring/src/reitit/ring.cljc +++ b/modules/reitit-ring/src/reitit/ring.cljc @@ -5,7 +5,8 @@ [reitit.impl :as impl] #?@(:clj [[ring.util.mime-type :as mime-type] [ring.util.response :as response]]) - [clojure.string :as str])) + [clojure.string :as str] + [reitit.exception :as ex])) (declare get-match) (declare get-router) @@ -99,9 +100,9 @@ :compile compile-result ::default-options-endpoint default-options-endpoint} opts)] - (assert (not (contains? opts ::default-options-handler)) - (str "Option `" ::default-options-handler "` is deprecated." - " Use `:" ::default-options-endpoint "` instead.")) + (when (contains? opts ::default-options-handler) + (ex/fail! (str "Option :reitit.ring/default-options-handler is deprecated." + " Use :reitit.ring/default-options-endpoint instead."))) (r/router data opts)))) (defn routes diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index 97250638..1c40defd 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -206,7 +206,7 @@ (deftest default-options-handler-test (testing "Assertion fails when using deprecated options-handler" - (is (thrown? java.lang.AssertionError (ring/router [] {::ring/default-options-handler (fn [_])}))))) + (is (thrown? ExceptionInfo (ring/router [] {::ring/default-options-handler (fn [_])}))))) (deftest default-options-endpoint-test (let [response {:status 200, :body "ok"}]