Community
Chat Logs
Wednesday, May 20, 2026
- jreicherjavabot: welcome back
- javabotjreicher, what does that even *mean*?
- jreicherOnly that I missed you. Never mind.
- jreicherHeh. cheeser the log of the above has the wrong nick for the bot. :)
- enoqlet's say you have some values in your configs that you need to set and they're absent due to a mistake, do you throw a custom exception here or reach for something like IllegalStateException?
- enoqthere's nothing to recover from really
- Inlineyah, let the user know the state is not ok
- Inlinenot because of something wrong but rather something missing/absent
- enoqso no RequiredConfigValueMissingException
- Inlineyah
- enoqI mean you can always explain the issue in the message
- Inlinethat exception by name already tells much
- InlineI don't think you want to spout more than required polluting the vision of the user etc.
- enoqnot sure if this is sarcasm or enlightenment
- Inlinefail early, fail hard, fail loudly
- Inlinehmmmm
- Inlinethere's no rule fail verbosely
- enoqat least my gutt feeling is that introducing custom exceptions makes sense if they could be caught
- Inlineright
- Inlineif it's domain specific anyway....
- Inlinecatch what you can
- Inlineand handle it if you can, otherwise err as generic
- BombeSometimes I do both: class RequiredValueMissing extends IllegateStateException {}.
- deeboanyone aware of some sort of "remote data repository" for spring data repositories over spring-data-rest ? just to avoid writing the client as well
- dreamreal~gpt anyone know of a spring client library for REST semantics, sort of a "remote data repository"?
- javabotYes, there is one such library called Spring RestTemplate. It's a synchronous HTTP client for making HTTP requests to consume RESTful web services. However, RestTemplate is in maintenance mode and the Spring team suggests using WebClient from the Spring WebFlux project for new projects. You can find more about WebClient here: https://docs.spring.io/spring-framework/docs/5.0.0.BUILD-SNAPSHOT/javadoc-api/org/springframework/web/reactive/function/client/Web
- dreamrealDO NOT PAY ATTENTION TO THE LLM.
- dreamrealThe problem is that it's not a "repository" - it's a rest call, and there's not a direct equivalent for repository semantics. RestTemplate > WebFlux, anyway.
- dreamrealYou could get closer with graphql, but only for read semantics.
- Parajdbc-over-http sounds like something people used to do back in the IT bubble days
- dreamrealthey didn't, though: it sounds like something that would have been tried, but getting connections over RMI was never allowed :D
- jreicherenoq: did you read the JDK definition of IllegalStateException? I don't think it's for what you have in mind. Also, why do you want to throw an exception at all? Does it help your code somehow?
- enoqjreicher, thank you, sounds like I need something else; as for the exception itself: yes, I can't proceed with the script invocation without the target API configs so exiting with an error seems fine
- jreicherHmm. How are you loading the configs? If you're using a library of some kind it'll probably have exceptions already.
- dreamrealWhy not throw RuntimeException or a derivative of it
- enoqjreicher, no library; I know there things like Spring provide an easy way to map that onto POJOs but it's a very simple script
- enoqdreamreal, that'd be the obvious case for defining a custom exception; just wondering if it's worth the ceremony and if there's something built in that works for these cases
- enoqcould also through a generic RuntimeException("message here") I guess
- dreamrealI'd say build the custom exception, personally; if that's "ceremony" your metric for ceremony's set very oddly to me
- dreamrealinodes are CHEAP
- enoqthanks
- jreicherenoq: in my opinion, since you're not using a standard library, and since it sounds like your program can't proceed with a malformed config, this boils down to the nicest way for your code to terminate. You could always call exit(), but allowing main to throw an exception might be nicer.
- jreicherWhat you might like to consider doing is writing the presence of the config as an assert, and then enabling the assertion mechanism. The rest will be taken care of for you.
- jreicherAs I said, it feels like a coding style question.
- enoqthank you