#What technology is there to avoid try/catch?
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @idle stratus! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
for... discord?
you mean for java?
if you need 10 try/catches per class that seems like an issue in its own right, not necessarily just of try/catch
i believe jda does have a functional api for that though
i honestly have no idea what you mean by that
discord doesn't change its api in breaking ways very often
but that isn't really relevant?
throws is used for methods to specify what checked exceptions they throw, not to handle throwing itself
can you show what you're trying/want to do
that's not how throws works
throws is used to propagate errors
try/catch is used to actually handle the errors
if you aren't using checked exceptions, then you don't need a throws to propagate them, they're propagated by default
throws is just required for checked exceptions, as part of the method signature
throws is not an alternative to try/catch
i feel like you don't understand exceptions as a whole tbh; might want to brush up on that
https://dev.java/learn/exceptions/
there isn't one
if you don't want the exception system entirely, look into using the functional apis of JDA as i mentioned
or attempt to avoid causing exceptions by implementing checks instead of trying & catching, wherever possible
with try/catch
that's what it's for
if you already have an exception, try..catch is how you handle it, or you can propagate it to the caller of the method to handle it instead (still with try..catch)
all i've mentioned above is to avoid exceptions
no, there literally isn't
you don't catch exceptions with stuff other than try/catch/finally or try-with-resources
i tried to ask what you actually mean by api, since you seem to be confusing the scope of it, but apparently that's not relevant?
god im so confused on what your question is
if you can clarify your question i'd be happy to try to answer again
@silent bramble seeing ghosts
🫂
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
How to solve exception by try and catch
are u using spring boot?