This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-28
Channels
- # adventofcode (2)
- # bangalore-clj (3)
- # beginners (171)
- # boot (28)
- # chestnut (3)
- # cljs-dev (20)
- # cljsjs (5)
- # clojure (280)
- # clojure-austin (1)
- # clojure-czech (1)
- # clojure-dev (9)
- # clojure-dusseldorf (2)
- # clojure-greece (20)
- # clojure-italy (6)
- # clojure-poland (16)
- # clojure-russia (7)
- # clojure-serbia (4)
- # clojure-sg (1)
- # clojure-spec (18)
- # clojure-uk (153)
- # clojurescript (57)
- # core-async (9)
- # cursive (21)
- # data-science (29)
- # datomic (18)
- # dirac (8)
- # docker (6)
- # duct (1)
- # emacs (50)
- # fulcro (15)
- # hoplon (56)
- # klipse (3)
- # leiningen (14)
- # lumo (1)
- # off-topic (5)
- # onyx (13)
- # other-languages (14)
- # pedestal (1)
- # perun (5)
- # planck (17)
- # re-frame (10)
- # reagent (2)
- # ring (1)
- # spacemacs (51)
- # sql (14)
- # test-check (16)
- # testing (1)
- # unrepl (93)
hey @cgrand, I wonder what do you think about having special print-limits settings for exceptions, particulary print-length... cider lets you set print-length and print-level for exceptions, I'm not entirely sure print-level is useful, but I can see people wanting to customize exception's print-length (I do it in my cider config)
also imo, string-length at 80 might be a bit short for exceptions, simple exception messages would get elided, like this one:
#unrepl/string ["java.lang.RuntimeException: Unable to resolve symbol: x in this context, compili" #unrepl/... {:get (unrepl.replG__16476/fetch :G__17055)}
👍 on the default
what would be a better default in your mind?
I think for exceptions I would go for unrestricted string-length... print-length would mostly affect the trace vector, so I think it would be cool to make it customizable
I've seen ex-info
s with ridiculous strings in it (where you pr-str
your entire state)
in general, i think the ideal would be to have exception print-limits separated from the rest
but maybe that's too niche
I think I tend to agree with you that it should be unlimited for exceptions
I lean towards, as a first step totally reversing exceptions: * display them bottom up * display them inside out (most wrapped exception first)
elide wrapped-by
(the reverse of the parent exception relationship), elide previous frames, print ex-info
when present
right now, afaik, ex-info
always comes from unrepl.repl/blame-ex
, right? it's always something like: "Exception during foo phase"
but since the phase is already part of the message payload, couldn't we just take that ex-info out?
:via
[{:type clojure.lang.ExceptionInfo,
:message "Exception during eval phase.",
:data {:unrepl.replG__16476/ex #error {#unrepl/... nil #unrepl/... {:get (unrepl.replG__16476/fetch :G__17054)}},
:unrepl.replG__16476/phase :eval},
:at [clojure.core$ex_info invokeStatic "core.clj" 4725]}
{:type clojure.lang.Compiler$CompilerException,
:message #unrepl/string ["java.lang.RuntimeException: Unable to resolve symbol: x in this context, compili" #unrepl/... {:get (unrepl.replG__16476/fetch :G__17055)}],
:at [clojure.lang.Compiler analyze "Compiler.java" 6720]}
{:type java.lang.RuntimeException,
:message "Unable to resolve symbol: x in this context",
:at [clojure.lang.Util runtimeException "Util.java" 221]}],
what I'm doing right now is just ommiting the first element in that vector, since I'm using the :phase
to insert a exception title
so ok, let me get back to what you were saying before and ask you some (probably noob) questions
when you're saying "display the exceptions bottom up", are you talking client-wise or protocol-wise?
client-wise it’s going to be roundtrip-painful (unless you get the whole exception at once)
can you explain the difference? not sure if I follow... right now I don't know how to get the wrapping information from the exception message payload. Not sure if it's because that information is not there or because I am missing something
Btw I've seen that exceptions get returned in different shapes on clojure 1.8 vs 1.9
couldn't figure this out while running on CI: https://clojurians.slack.com/archives/C03S1KBA2/p1511870643000121
@pesterhazy I think ./clj is the official answer to this
@dominicm is that bundled with clojure?
official instructions for doing things manually would be appreciated
@cgrand, oh the spec dep is right there on the mvn site
@cgrand notice after resolving the first elision there are a couple of misalignments? I'm trying to pad the file name and lineno using the max length of what i can see in the :trace
vector, but since it is elided, I cannot render it well
@volrath nice. since 1.8/direct linking every stack frame is doubled because of invoke+invokeStatic, would be cool to elide adjacent frames
cool, thanks for the input! tbh I don't know much about this, could you point me to some info?
basically pre-clojure 1.8 functions got compiled into a java class that implemented a single method invoke()
Now with this direct-linking mode (which improves performance) the invoke() which is an instance method, calls down to an invokeStatic() which is a static class method. This results in longer stack frames
if you see a foo.invoke() that immediately calls foo.invokeStatic() in a stack trace, one of them should disappear
@cgrand you never got to tell me your thoughts on managing print limits for exceptions separately
even though I do believe that customization is the key of happiness, that's not my point... stacktraces are consumed by people in different ways
I'm not saying a different print-limits management for every data type or anything like that
but I feel this is something people should be able to customize. as we know, exceptions/stacktraces are not the best thing in clojure, and unless we find the holygrail on how to deal with them (doubt it), i think we should give people the ability to customize
I'll update the issue I created for settings with this and with the other problem we discussed the other day, about being able to edit settings from aux that also affect user (so that we don't have to ever use unrepl/do in user)
you need contextual display... but you probably need the same data in the different contexts
I have been too lazy to implement this for a while, but translating "Well-Known Signatures" in stacktraces to user-friendly displays. For example, an exception while realizing a lazy seq always contains LazySeq.sval() and LazySeq.seq() adjacently.
There are a lot of landmark function calls in clojure.lang.RT and clojure.lang.* that we could rewrite
@ghadi I’ve also been thinking about using frequencies of stack frames to drive elision.
moving the discussion to main thread