Thanks Sean, the stuff with file/line and thread name was helpful!
I updated my own logging-future macro(s) - here's an interesting version
(logging-future+) that logs the client stacktrace at the time when it
called future.
I often find that much more useful that the stacktrace inside the
Thank you, Sean. That is an excellent example.
-austin
On Sunday, January 3, 2021 at 12:48:55 PM UTC-8 Sean Corfield wrote:
> Austin,
>
> You might find a macro like this helpful -- just use it directly instead
> of future. You can replace println with whatever sort of logging you want.
>
>
Austin,
You might find a macro like this helpful -- just use it directly instead of
future. You can replace println with whatever sort of logging you want.
(defmacro logged-future
"Given a body, execute it in a try/catch and log any errors."
[& body]
(let [line (:line (meta ))
file *file*]
Ah, thanks for pointing that out. I must've overlooked your example,
because I'd already written off futures.
It seems like what you are suggesting, catch and print, might be about as
good as I could hope for. If I don't want to block the main thread, then I
don't see what else I could
to be clear, in my second example you see the error from the future without
using deref
good luck finding your solution
On Sat, Jan 2, 2021 at 12:50 PM Austin Haas wrote:
> Thank you very much for the explanation, Justin.
>
> I don't see how I can use futures, though, without blocking on the
Thank you very much for the explanation, Justin.
I don't see how I can use futures, though, without blocking on the main
thread (to get the exception when it occurs). I'm spawning a long-running
process that never returns a value.
On Saturday, January 2, 2021 at 12:43:14 AM UTC-8
By the time the exception is caught, you are already outside the context of
the Thread which the repl client is interacting with. The default exception
handler has no information tying the executing thread to the repl process
(not to mention the dynamic variables clojure is using to associate