I'm not sure what I did, but suddenly I'm getting this:

Exception: clojure.lang.ExceptionInfo thrown from the 
UncaughtExceptionHandler in thread "main"

Exception: clojure.lang.ExceptionInfo thrown from the 
UncaughtExceptionHandler in thread "Thread-0"

I had been using println to do some debugging, but then I added :

                 [com.taoensso/timbre "4.10.0"]

I think that is the last think I did. Then I did: 

lein uberjar

And then I tried to run that from the command line. 

I've added a bunch of logging to try to get a stacktrace, but none of this 
is working so far: 

(defn -main [& args]

  (slingshot/try+

   ;; 2017-10-04 -- see this:
   ;; 
https://stackoverflow.com/questions/28908835/ssl-peer-shut-down-incorrectly-in-java
   (System/setProperty "https.protocols" "TLSv1.1")
   
   (.addShutdownHook (Runtime/getRuntime)
                     (Thread.
                      #(do (error "addShutdownHook triggered. This app is 
shutting down.")
                           (stop))))

   ;; 2017-07-12 -- stealing code from here:
   ;; https://stuartsierra.com/2015/05/27/clojure-uncaught-exceptions
   ;; Assuming require [clojure.tools.logging :as log]
   (Thread/setDefaultUncaughtExceptionHandler
    (reify Thread$UncaughtExceptionHandler
      (uncaughtException [_ thread ex]
        (log "the app has died ")
        (log ex)
        (log "Uncaught background exception on thread " (.getName thread) " 
Caught by Thread/setDefaultUncaughtExceptionHandler in core/main.")
        (System/exit 1))))

   (slingshot/try+
    (start)
    (catch Exception e
      (stack/parse-exception e)
      (log (str e))
      (log "the app has died!")
      (System/exit 1))
    (catch Throwable t
      (log t)
      (log "the app has died!")
      (System/exit 1))
    (catch Object o
      (log o)
      (log "the app has died!")
      (System/exit 1)))))


And yet all I get is:

Exception: clojure.lang.ExceptionInfo thrown from the 
UncaughtExceptionHandler in thread "main"

Exception: clojure.lang.ExceptionInfo thrown from the 
UncaughtExceptionHandler in thread "Thread-0"

Somehow the other lines that I try to print never get called. Nor my call 
to my log function which should give me a stacktrace. 

What is the obvious thing to do here?






-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to