Chat Logs

  1. jreicherjavabot: welcome back
  2. javabotjreicher, what does that even *mean*?
  3. jreicherOnly that I missed you. Never mind.
  4. jreicherHeh. cheeser the log of the above has the wrong nick for the bot. :)
  5. 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?
  6. enoqthere's nothing to recover from really
  7. Inlineyah, let the user know the state is not ok
  8. Inlinenot because of something wrong but rather something missing/absent
  9. enoqso no RequiredConfigValueMissingException
  10. Inlineyah
  11. enoqI mean you can always explain the issue in the message
  12. Inlinethat exception by name already tells much
  13. InlineI don't think you want to spout more than required polluting the vision of the user etc.
  14. enoqnot sure if this is sarcasm or enlightenment
  15. Inlinefail early, fail hard, fail loudly
  16. Inlinehmmmm
  17. Inlinethere's no rule fail verbosely
  18. enoqat least my gutt feeling is that introducing custom exceptions makes sense if they could be caught
  19. Inlineright
  20. Inlineif it's domain specific anyway....
  21. Inlinecatch what you can
  22. Inlineand handle it if you can, otherwise err as generic
  23. BombeSometimes I do both: class RequiredValueMissing extends IllegateStateException {}.
  24. 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
  25. dreamreal~gpt anyone know of a spring client library for REST semantics, sort of a "remote data repository"?
  26. 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
  27. dreamrealDO NOT PAY ATTENTION TO THE LLM.
  28. 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.
  29. dreamrealYou could get closer with graphql, but only for read semantics.
  30. Parajdbc-over-http sounds like something people used to do back in the IT bubble days
  31. dreamrealthey didn't, though: it sounds like something that would have been tried, but getting connections over RMI was never allowed :D
  32. 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?
  33. 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
  34. jreicherHmm. How are you loading the configs? If you're using a library of some kind it'll probably have exceptions already.
  35. dreamrealWhy not throw RuntimeException or a derivative of it
  36. 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
  37. 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
  38. enoqcould also through a generic RuntimeException("message here") I guess
  39. dreamrealI'd say build the custom exception, personally; if that's "ceremony" your metric for ceremony's set very oddly to me
  40. dreamrealinodes are CHEAP
  41. enoqthanks
  42. 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.
  43. 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.
  44. jreicherAs I said, it feels like a coding style question.
  45. enoqthank you