#What technology is there to avoid try/catch?

1 messages · Page 1 of 1 (latest)

normal thornBOT
#

This post has been reserved for your question.

Hey @idle stratus! Please use /close or the Close Post button 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.

silent bramble
#

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

silent bramble
#

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

silent bramble
#

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

regal harbor
#

@silent bramble seeing ghosts

silent bramble
#

lmao

#

this bs again, eh

regal harbor
normal thornBOT
#

💤 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.

civic dome
#

How to solve exception by try and catch

silent bramble
#

this is not your thread.

#

#❗︱how-to-get-help

rain basalt
#

are u using spring boot?