babashka-sci-dev

Crispin 2022-09-02T07:54:28.721859Z

Is there a way of getting better exceptions coming out of my pod?

Crispin 2022-09-02T07:55:00.946699Z

When an invoke call raises an exception, it ends up with the wrong line number

Crispin 2022-09-02T07:55:51.302029Z

I submit my error raised in the pod call here:

Crispin 2022-09-02T07:57:36.894419Z

And running a script that triggers that I get this:

Crispin 2022-09-02T07:58:21.660699Z

$ 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:3

Crispin 2022-09-02T07:59:52.845959Z

line 25 is actually blank. It is actually line 61 that is executing when this gets raised.

Crispin 2022-09-02T08:00:23.872199Z

some kind of metadata I need to preserve or add, perhaps?

Crispin 2022-09-02T08:22:17.150749Z

the stack trace is actually correct. It's just displaying the wrong file

Crispin 2022-09-02T08:23:07.538939Z

pod.epiccastle.bbssh.session/connect is not from /home/crispin/dev/clojure/bbssh/test/bb.clj, it is injected into the pod apon describe

Crispin 2022-09-02T08:23:37.468209Z

the stack trace line my-project.core is actually the correct line

Crispin 2022-09-02T08:25:02.082579Z

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.

Crispin 2022-09-02T08:27:35.197449Z

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": [...]}

borkdude 2022-09-02T18:15:02.051109Z

yeah, I'm not sure, haven't thought deeply about pod errors + locations

borkdude 2022-09-02T18:20:07.606369Z

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...

borkdude 2022-09-02T18:22:09.065419Z

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?

Crispin 2022-09-03T01:40:41.758639Z

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.

Crispin 2022-09-03T01:40:50.103739Z

I can have a poke around see what I can do