Fork me on GitHub
#babashka
<
2023-02-16
>
jmglov06:02:26

When an exception gets thrown and I catch it, I get a stacktrace that seems to only point to babashka / sci internals (see https://gist.github.com/jmglov/b33c80c949ca10983bf212460dd964d0 for an example stacktrace). Is there something I can do to get the location in my code where the exception occurred? Babashka itself does this if I don't catch the exception, but I want to catch it so I can print a nicer error message before exiting. Apologies if this has already been asked and answered; I tried searching this channel, but "in:#babashka exception" turns up a lot of hits. πŸ˜…

βœ… 2
jmglov08:02:06

Amazing! Thanks! πŸ™‚

borkdude10:02:52

Here is an article for how to enable vulnerability scanning on dependencies bundled in a native image, like babashka: https://medium.com/graalvm/using-graalvm-native-image-sbom-support-for-vulnerability-scanning-4211c747376 If someone would like to enable this and show that it works, feel free

keychera13:02:43

Hello, everyone. I want to share something that I made with Babashka and follow up with a question. So I made this middleware function and a main so that I can have live reload just with babashka to serve html (or htmx) using a lot of mechanisms that htmx provides (websockets client, swapping html fragments). With some patches here and there, it works... surprisingly well! (for my use case, at least) I also managed to make CSS changes play nicely even using tailwindcss. the video below is that code in action So I decided that I want to β€œshare” this code, so at least that I can use the same code in several of my projects, and others that might want to use it as well. How do you distribute code like this? also other than babashka, I also have been using this code in Clojure JVM with just small changes, but the way I use it is to copy the source and put all in my extra-classpath and deal with code differences, which is not ideal I think, so how do I approach this? Any pointers would be appreciated.

keychera13:02:23

A smallest example that you can try with just cloning and babashka is here https://github.com/keychera/panas.reload the video above is my code playground that uses the same live reload (you can see the project here, need tailwindcss here) https://github.com/keychera/bantu

borkdude13:02:08

Looks super great! Sharing code is usually done by making a library

borkdude13:02:33

You can make a library (both for bb and JVM clj) by putting code in a github repo and adding a deps.edn, that's it

borkdude13:02:44

Then you can use the library by adding it to bb.edn (for bb) or deps.edn (for JVM clj) by e.g. {:deps {io.github.keychera/panas.reload {:git/sha "..."}}}

keychera13:02:50

Thanls for the pointer @U04V15CAJ! I'm gonna try it as soon as I got the chance

keychera10:02:48

just wanna report back here a little, I just tried it and it work seamlessly, kinda feels like magic honestly, just like my overall experience with clojure anyway, just also wanna say thanks again @U04V15CAJ

❀️ 2
oly15:02:54

whats my best bet for simple http with simple routing hhtp kit http-server ? how about routing ?

borkdude15:02:47

yes, httpkit http-server is built-in

borkdude15:02:05

if your goal is to simply server static files, then you can use: https://github.com/babashka/http-server/

oly16:02:41

I basically want a single url which checks for the existence of folders

oly16:02:24

I saw http-server and http-kit but thought they basically did the same thing, I will take a look at ruuter cheers

borkdude16:02:53

http-server uses http-kit

borkdude16:02:02

but it implements a file browser

borkdude22:02:54

kibit-style linter that can run with babashka

😍 2