Is there a way of getting better exceptions coming out of my pod?
When an invoke call raises an exception, it ends up with the wrong line number
I submit my error raised in the pod call here:
And running a script that triggers that I get this:
$ bb test/bb.clj
loading pod...
loaded
:prompt-password "Password for crispin@localhost"
:get-password
:prompt-password "Password for crispin@localhost"
:get-password
:prompt-password "Password for crispin@localhost"
:get-password
:prompt-password "Password for crispin@localhost"
:get-password
:prompt-password "Password for crispin@localhost"
:get-password
:prompt-password "Password for crispin@localhost"
:get-password
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: SSH_MSG_DISCONNECT: 2 Too many authentication failures
Data: {:type com.jcraft.jsch.JSchException}
Location: /home/crispin/dev/clojure/bbssh/test/bb.clj:25:3
----- Context ------------------------------------------------------------------
21: "bbssh.core"] {:transport :socket})
22:
23: ;; run pod process from native-image to test
24: #_(pods/load-pod "./bbssh" {:transport :socket})
25:
^--- SSH_MSG_DISCONNECT: 2 Too many authentication failures
26: (println "loaded")
27:
28: (require
29: '[pod.epiccastle.bbssh.user-info :as user-info]
30: '[pod.epiccastle.bbssh.session :as session]
----- Stack trace --------------------------------------------------------------
babashka.pods.impl/processor - <built-in>
babashka.pods.sci/load-pod/fn--27349 - <built-in>
pod.epiccastle.bbssh.session/connect - /home/crispin/dev/clojure/bbssh/test/bb.clj:25:3
pod.epiccastle.bbssh.session/connect - /home/crispin/dev/clojure/bbssh/test/bb.clj:21:1
my-project.core - /home/crispin/dev/clojure/bbssh/test/bb.clj:61:3line 25 is actually blank. It is actually line 61 that is executing when this gets raised.
some kind of metadata I need to preserve or add, perhaps?
the stack trace is actually correct. It's just displaying the wrong file
pod.epiccastle.bbssh.session/connect is not from /home/crispin/dev/clojure/bbssh/test/bb.clj, it is injected into the pod apon describe
the stack trace line my-project.core is actually the correct line
maybe if the file associated with pod.epiccastle.bbssh.session was something like the <built-in>. Or it could even refer to the source file within the pod project. That would be pretty sweet.
Maybe there could be a filename registered with the describe response? Like {"namespace": "pod.epiccastle.bbssh.session", "filename": "<pod:pod/epiccastle/bbssh/session.clj>", "vars": [...]}
yeah, I'm not sure, haven't thought deeply about pod errors + locations
it's a bit like calling HTTP APIs. The error probably is reported at the site where you call an HTTP client, not the location of the response in a server that crashed...
I would at least expect that the location of the client side function that calls the pod would be reported. Isn't that the case?
If when displaying the code with the traceback you looked for the first frame with a valid filename, and displayed that. ie you skipped any filenames of the format <*>. Then, if the injected describe namespaces had one of those <*> names, they would be skipped, and the file that would be displayed would be the correct one, at the correct line.
I can have a poke around see what I can do