This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (8)
- # aws (8)
- # babashka (21)
- # beginners (125)
- # calva (12)
- # cider (10)
- # circleci (29)
- # clara (6)
- # clj-kondo (34)
- # cljdoc (3)
- # cljfx (65)
- # cljs-dev (18)
- # clojure (38)
- # clojure-australia (4)
- # clojure-berlin (5)
- # clojure-czech (2)
- # clojure-dev (15)
- # clojure-europe (22)
- # clojure-nl (3)
- # clojure-uk (31)
- # clojuredesign-podcast (7)
- # clojurescript (87)
- # code-reviews (1)
- # conjure (3)
- # cursive (2)
- # data-science (1)
- # datalog (1)
- # datomic (36)
- # emacs (12)
- # events (1)
- # fulcro (3)
- # graalvm (68)
- # instaparse (2)
- # jackdaw (2)
- # jobs (2)
- # leiningen (8)
- # luminus (2)
- # nrepl (31)
- # pedestal (44)
- # releases (1)
- # remote-jobs (6)
- # shadow-cljs (4)
- # spacemacs (4)
- # sql (13)
- # tools-deps (52)
- # uncomplicate (4)
- # xtdb (40)
- # yada (11)
This might have been asked before but what is the clojure way to catch an ex-info and rethrow it with augmented ex-data (while not changing other parts of the exception) ?
ExceptionInfo objects are immutable, so it's not possible to actually augment the original exception object. You can pull out the message, data, and if desired, stack trace, and make a new ex-info though and throw that. The message and data are pretty obvious but you can use .getStackTrace and .setStackTrace to transfer that.
you might also be interested in https://github.com/scgilardi/slingshot which has a bunch of interesting facilities in this area
any decent libraries for GCP in particular I want to use cloud storage I see we have amazonica and aws-api's for amazon cloud but not seeing anything that seems as upto date or as comprehensive, anyone have any experience in this area ?
In general GCP's Java SDK is pretty ok to use directly from Clojure (in my experience), so a wrapper is not necessary
You could ask over in #google-cloud. It’s not terribly active, but people seem to respond to questions
okay good to know, I was hoping to find a storages client that did aws cloud storage spaces and minio all in one so the service is not tied to a platform
If it helps - Minio can act as a proxy for google cloud storage, so you can use a S3 client, talk to minio and that will translate API calls from S3-style to Google Cloud
I'm pretty sure a universal client for Mino, S3 and Google Cloud doesn't exist in Clojure - but it's not hard to implement using protocols etc. We had one, but eventually we settled 100% on S3 and use Minio only in CI
I'm not multi cloud or anything - I just have a local/test impl for stuff - but even protocols might be overkill depending on the task
Sure that works too. We use records+protocols because we use Component and we model api clients as components too - including S3 and such. Just makes it easier to manage dependencies of things
Thanks for the info, we have moved from AWS to GCP a while back but not tying your apps to any infrastructure makes moving between them much simpler, quite likely we will re asses which is better for us at some point.
Yes I can not find that exception, I tried to throw it using java lang esception class, this also doesn not work.
If you could put the exact code you tried, that might be helpful for people to know what you are looking for. UnauthorizedAccessException is not a part of the JVM but of the CLR (.Net). Are you using clojure on the jvm? If so, do you have the full name of the exception you want to throw? Do you need to throw a specific exception, or just want an exception to communicate a particular message? If the latter, try out https://clojuredocs.org/clojure.core/ex-info
(defn execute-study-header-get [study_uuid study_id database_id param] (let [sponsor_id (str (get-sponsor-config param)) study-selections (get-study-selections-with-forecasts sponsor_id) data (map (fn [x] (dissoc x :sponsorName :projectName :studyStatus :phase :indication :forecastID :forecastName)) (:data study-selections)) result (map (fn [input] (and (= (:studyID input) study_id) (= (:databaseID input) database_id) (= (:UUID input) study_uuid)) ) data) check (some #(= % true) result)] (if (not= check true) "401" (execute-study-header study_uuid study_id database_id)))) My task is to throw UnauthorizedAccessException 401 instead of string "401" in the last line of the code.
Is this is some assignment? If so you should ask the person who gave it to you for clarification. There is no built-in exception called UnauthorizedAccessException. So you can use ex-info or you can make a custom exception. https://stackoverflow.com/questions/3835331/custom-exceptions-in-clojure
> If the stack trace of this Throwable is not writable, calling this method has no effect other than validating its argument.
Also initCause, which docs say is typically called within the constructor, but if not, it can be called at most once per Throwable object after construction.
I've tried mutating exceptions unsuccessfully before that's why I assumed they were immutable by design, but not quite
Then of course there is the "peeking under the Clojure API covers" kind of cheating where you can mutate Clojure collections, to no good effect.
Unless your goal is to get pedants like me into a discussion of what immutable really means 🙂
Reminds me of "private is a state of mind" by Alex Miller. Probably immutability is as well, although Clojure does quite a good job to enforce it (better than private ;))
I haven't heard that quote before, but yeah, that is also sure to raise discussion among developers who like stronger language-enforcable gaurantees on information hiding.