Skip to content

Commit

Permalink
shorten error message when dev-http port is taken
Browse files Browse the repository at this point in the history
fixes #450
  • Loading branch information
thheller committed Feb 28, 2019
1 parent eb2e305 commit 3623915
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/shadow/cljs/devtools/server/dev_http.clj
Expand Up @@ -12,7 +12,8 @@
[shadow.http.push-state :as push-state]
[clojure.string :as str])
(:import [io.undertow.server HttpHandler ExchangeCompletionListener]
[shadow.undertow ShadowResourceHandler]))
[shadow.undertow ShadowResourceHandler]
[java.net BindException]))

(defmethod undertow/build* ::file-recorder [state [id {:keys [on-request] :as props} next]]
(assert (vector? next))
Expand Down Expand Up @@ -129,7 +130,12 @@
(let [srv (try
(undertow/start http-options handler-config)
(catch Exception e
(log/warn-ex e ::http-start-ex {:http-options http-options :config config})
(cond
(instance? BindException (.getCause e))
(log/warn :shadow.cljs.devtools.server/tcp-port-unavailable {:port port})

:else
(log/warn-ex e ::http-start-ex {:http-options http-options :config config}))
nil))]
(cond
(some? srv)
Expand Down

0 comments on commit 3623915

Please sign in to comment.