This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-08
Channels
- # aleph (2)
- # announcements (2)
- # asami (50)
- # babashka (39)
- # beginners (17)
- # calva (61)
- # cider (9)
- # clj-kondo (5)
- # clojure (37)
- # clojure-europe (52)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (5)
- # clojurescript (28)
- # cursive (3)
- # datahike (11)
- # datomic (28)
- # deps-new (11)
- # events (3)
- # fulcro (18)
- # google-cloud (1)
- # graphql (8)
- # introduce-yourself (4)
- # jobs (2)
- # leiningen (7)
- # lsp (15)
- # pathom (9)
- # re-frame (6)
- # reagent (35)
- # reitit (17)
- # releases (1)
- # shadow-cljs (20)
- # specter (1)
- # test-check (106)
- # tools-deps (8)
- # uncomplicate (1)
- # vim (29)
This has me somewhat baffled:
(defmacro command-with-header [fname args description & body]
`(defn ~fname ~args ~description [email protected] <<<<< FOUND: This [email protected] was not supposed to be there.
(println ~(str fname) ": " ~description)
(println "--------------------------------------")
[email protected]))
(command-with-header test5 [] "this command does something" (prn "Command output"))
(test5)
Outputs:
"Command output"
test5 : this command does something
--------------------------------------
"Command output"
The body seems executed twice or something? Why is "Command output" being written once before the first println, and then (as expected) after?You're seeing "Command output"
twice, because [email protected]
is in there twice.
How does dependency resolution work with tool.deps when I explicitly list x as a dep and then a different dep includes a different version of x as a subdep?
explicit version takes precedence over transitive one
note that this only applies to top level versions
lots more detail at https://clojure.org/reference/dep_expansion
I have the following handler:
(defn save-student-contact-handler
[{:keys [path-params current-user params]}]
(prn params)
(prn path-params)
;; authorize current-user can save contact
(let [r (db/by-id (read-string (:roleId path-params)))
res (role/create-contact current-user (:db/id r) params)]
(prn "r" r)
(prn "res " res)
(response res)))
where response
is [ring.util.response :refer [response]]
and res is printing "res " #:db{:id 17592186045455}
. But when Iām sending a response this way with response res
, Iām getting status 500 in the client:
{:response {:status 500, :body {:type "exception", :class "java.lang.StackOverflowError"}, :headers {"Content-Type" "application/octet-stream", "X-XSS-Protection" "1; mode=block", "X-Frame-Options" "SAMEORIGIN", "X-Content-Type-Options" "nosniff"}}, :request {:protocol "HTTP/1.1", :remote-addr "127.0.0.1", :headers {"host" "localhost", "cookie" "lms=value=eyJhbGciOiJSUzI1NiJ9.MTc1OTIxODYwNDU0Mzc.C__Y62-bNNfzPabQrOEj-YkxUdLuX51ob8GUEwvDCM3MWkJ4hXltLw4PiaOoTtat2XmtnGLWVNZ6xOKhr-d90o0CrMggfG75MWxnt6VleeODEldHc6M-864oND7fv0sIFJZQLEYzixmF4xWK1myRddK3sonJSidHyDkkOjTh2kEcBpKJwljfnM_4xeHIYxBykKIr3PUj7cXVHlNhXc7H3s7X7UmnKzqjqRnjixBjgyUyInjGsVfcaRQAoGCwkZNK5oYILif4ZHhUKJS7vKRhtqyQt7LchpX4TmBfgBwhg6EZpo3_aBu-628JIXkxq_qQUMLEqHuvVxQhrCCav3pB4g", "content-type" "application/json"}, :server-port 80, :content-type "application/json", :uri "/api/students/17592186045450/contacts", :server-name "localhost", :body #object[java.io.ByteArrayInputStream 0x4a47e29e "[email protected]"], :scheme :http, :request-method :post}, :headers nil, :app #object[clojure.lang.AFunction$1 0xf264b24 "[email protected]"], :content-type "application/json", :cookie-jar {"localhost" {"lms" {:value "value=eyJhbGciOiJSUzI1NiJ9.MTc1OTIxODYwNDU0Mzc.C__Y62-bNNfzPabQrOEj-YkxUdLuX51ob8GUEwvDCM3MWkJ4hXltLw4PiaOoTtat2XmtnGLWVNZ6xOKhr-d90o0CrMggfG75MWxnt6VleeODEldHc6M-864oND7fv0sIFJZQLEYzixmF4xWK1myRddK3sonJSidHyDkkOjTh2kEcBpKJwljfnM_4xeHIYxBykKIr3PUj7cXVHlNhXc7H3s7X7UmnKzqjqRnjixBjgyUyInjGsVfcaRQAoGCwkZNK5oYILif4ZHhUKJS7vKRhtqyQt7LchpX4TmBfgBwhg6EZpo3_aBu-628JIXkxq_qQUMLEqHuvVxQhrCCav3pB4g", :path "/api/", :domain "localhost", :raw "lms=value=eyJhbGciOiJSUzI1NiJ9.MTc1OTIxODYwNDU0Mzc.C__Y62-bNNfzPabQrOEj-YkxUdLuX51ob8GUEwvDCM3MWkJ4hXltLw4PiaOoTtat2XmtnGLWVNZ6xOKhr-d90o0CrMggfG75MWxnt6VleeODEldHc6M-864oND7fv0sIFJZQLEYzixmF4xWK1myRddK3sonJSidHyDkkOjTh2kEcBpKJwljfnM_4xeHIYxBykKIr3PUj7cXVHlNhXc7H3s7X7UmnKzqjqRnjixBjgyUyInjGsVfcaRQAoGCwkZNK5oYILif4ZHhUKJS7vKRhtqyQt7LchpX4TmBfgBwhg6EZpo3_aBu-628JIXkxq_qQUMLEqHuvVxQhrCCav3pB4g"}}}}
But I can send the following without problems: (response (:db/id res))
How do I fix this?it will depend on what the type of res is (not how it prints) and what response does with that kind of type