Fork me on GitHub
#clojure
<
2024-08-08
>
Степан Антипов09:08:19

Hello everyone. Please recommend libraries for automating API testing of a ready-made application

p-himik11:08:03

Can't recommend anything myself but I'd try searching in #C06MAR553 and with https://phronmophobic.github.io/dewey/search.html.

roklenarcic14:08:59

Is there a way to tell Timbre to print of an exception and also all its causes, not just the inner-most cause? If I do this:

(try
  @(p/future (throw (Exception.)))
  (catch Exception e
    (.printStackTrace e)))
I get printed the stack trace of both Exception and ExecutionException:
java.util.concurrent.ExecutionException: java.lang.Exception
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2063)
	at clojure.core$deref_future.invokeStatic(core.clj:2317)
	at clojure.core$deref.invokeStatic(core.clj:2337)
	at clojure.core$deref.invoke(core.clj:2323)
	at nrepl.middleware.session$session_exec$main_loop__1077.invoke(session.clj:201)
    ....
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.Exception
    ...
	at promesa.exec$wrap_bindings$fn__15950.invoke(exec.cljc:200)
	at promesa.util.Supplier.get(util.cljc:34)
But when I use Tibre I just get the last one:
(try
  @(p/future (throw (Exception.)))
  (catch Exception e
    (log/error e)))

2024-08-08T14:10:21.722Z Roks-MacBook-Pro-2.local ERROR [.portal.core:4] - 
           java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
             java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1598
                  java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1665
java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1016
                java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
 java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1756
  java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1764
                               promesa.util.Supplier/get                  util.cljc:   34
                           promesa.exec/wrap-bindings/fn                  exec.cljc:  200
             .portal.core/eval49046/fn                 REPL Input:     
                    java.lang.Exception:
java.util.concurrent.ExecutionException: java.lang.Exception
So I have no context where the future was “used” so the stack trace is pretty much useless at locating where the error occurred.

p-himik16:08:41

Honestly, I feel a bit awkward doing the same thing to the same person two times in a row. :D But as you can guess, the common advice people often get here when the word "Timbre" is mentioned in a context of some problem is to stop using Timbre. Of course, you can just search for the word "Timbre" in this channel to see the reasons why, but the gist that I remember: • It hides not only causes but also some lines from the stacktrace. More often than not, it ends up being more confusing than helpful, especially when a person knows where the removed lines would come from • It changes the output format, which potentially makes your IDE confused (e.g. Cursive will offer helpful links to each location if the stacktrace is standard but IIRC the Timbre stacktrace doesn't have links - I have to go to locations that interest me by hand) • It doesn't look familiar to most people here, so it would be a bit harder to get help

p-himik16:08:54

A relevant issue with a solution, which doesn't seem to be trivial: https://github.com/taoensso/timbre/issues/317

roklenarcic17:08:00

thanks, this is just what I needed

vemv22:08:05

In case it helps, my Timbre setup has a Sentry appender, timbre-json-appender and a tap> appender. I can see the full chain for all those. You can plug anything really and enable specific appenders depending on the context.