Fork me on GitHub
#clojure
<
2019-02-02
>
p4ulcristian06:02:43

only when want to lein uberjar, with figwheel it works

p4ulcristian06:02:04

if I don't use (wrap-defaults site-defaults) it doesn't throw this error

seancorfield06:02:27

Base on that stack trace @paul931224 it sounds like you're putting something invalid in the cookie "scope"?

p4ulcristian06:02:46

I deleted all the wrappers, where am I putting something in a cookie other than there?

p4ulcristian06:02:03

and why only with wrap-defaults?

seancorfield06:02:46

wrap-defaults adds a bunch of logic, and checks, around various parts of the Ring request/response so you wouldn't get the exception without it because not much is checked.

seancorfield07:02:48

Without seeing all your code it's hard to say what the problem is, but that error suggests that it thinks you are putting "bad attributes" into the :cookies key of the Ring request/response...

p4ulcristian07:02:57

I also use sente, can it be the problem?

p4ulcristian07:02:41

and why is this specific too compiling? with lein figwheel works well

p4ulcristian07:02:40

I can show all my code, but it is a pretty big project, I just wanted to put it up on the server

seancorfield07:02:26

I'd be surprised if Sente was incompatible with Ring defaults...

seancorfield07:02:21

I would add some println debugging to see what the Ring request/response looks like and see if you can figure out what's the various submaps...

p4ulcristian07:02:38

I don't even know how that "_ga" gets there, I dont have google analytics, I also remove google maps too

p4ulcristian07:02:05

oh, it was in cache, same error, nothing in :cookies

p4ulcristian07:02:57

well, it was a dependency problem

p4ulcristian07:02:12

:exclusions [ring/ring-core] solved it

p4ulcristian07:02:00

[ring-transit-middleware "0.1.3" :exclusions [ring/ring-core]]

p4ulcristian07:02:20

thank you anyway, I never tried printing in a wrapper before, the more you know... 😄

witek12:02:07

I would like to use tap> to debug. But since tap> retrns true/`false` and not the provided parameter, this is not trivial. What would be an elegant statement, which calls tap> whith my statement (+ 1 2) and then returns the value of my statement?

witek12:02:27

Looking for something shorter then (let [result (+ 1 2)] (tap> result) result)

Jan K12:02:02

@witek (doto (+ 1 2) tap>)

Jan K12:02:41

I usually define something like (defn spy> [x] (doto x tap>))

Alex Miller (Clojure team)14:02:14

Having tap> return the val is a pretty good idea - if you write up a CLJ jira for it, that would remind me to talk to Rich about it

👍 5
Alex Miller (Clojure team)14:02:08

Or adding spy> or something

vemv15:02:12

code above, error below

vemv15:02:15

any workaround?

vemv15:02:29

got it (ns-unmap *ns* 'Compiler)

bowie 10
stathissideris20:02:14

I’m trying to write a macro that will allow me to def a var with certain metadata attached. Using the reader macro in the middle of the macro doesn’t work!

lilactown20:02:00

that’s true. I believe you can use alter-meta!

stathissideris20:02:03

got it working! my motivation for this is to def a function in a namespace and preserve the docstring and arglists of a function from another namespace:

(defmacro def-with-doc [nom var-sym]
  (let [doc      (-> var-sym resolve meta :doc)
        arglists (-> var-sym resolve meta :arglists)]
    `(do
       ~(if doc
          `(def ~nom ~doc ~(-> var-sym resolve deref))
          `(def ~nom ~(-> var-sym resolve deref)))
       ~(when arglists
          `(alter-meta! (var ~nom) assoc :arglists (quote ~arglists))))))

(def-with-doc inspect ins/inspect)

🎉 5
👏 10
Jan K20:02:16

this library has import-vars that does a similar thing, it keeps docstrings and works for fuctions and macros https://github.com/ztellman/potemkin

seancorfield21:02:14

Why not assoc :doc in the way you handle :arglists, then you don't need the if special case.

seancorfield21:02:18

You can avoid the conditionals altogther, like this

(defmacro def-with-doc [nom var-sym]
  `(do
    (def ~nom ~(-> var-sym resolve deref))
    (alter-meta! (var ~nom) merge '~(-> var-sym resolve meta (select-keys [:doc :arglists])))))

seancorfield21:02:24

If you want that to work for macros too, add :macro to the keys in the select-keys call.