SCJP, SCWCD
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
Catch 'em, wrap 'em, and chuck 'em?
[ April 16, 2003: Message edited by: Barry Gaunt ]
SCJP, SCWCD
Nick Lee
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
Sorry, my post was a little cryptic![]()
You catch the IOException ioe, say, and then do something like: throw new RecordNotFoundException( "IOException in seek", ioe);
Take a look at the Java 1.4 API for Exception and Throwable.
[ April 16, 2003: Message edited by: Barry Gaunt ]
SCJP, SCWCD
Originally posted by Nick Lee:
hi Wagner,
I think u should use try-catch block to find IOException,if u haven't declear it in ur method definition.
SCJP, SCWCD
Originally posted by Barry Gaunt:
Sorry, my post was a little cryptic![]()
You catch the IOException ioe, say, and then do something like: throw new RecordNotFoundException( "IOException in seek", ioe);
Take a look at the Java 1.4 API for Exception and Throwable.
[ April 16, 2003: Message edited by: Barry Gaunt ]
SCJP, SCWCD
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
Another thought just occurred. In the really bad cases it is possible to throw a RuntimeException, that is an unchecked exception, that does not need to be declared in the throws clause. It is no problem to define our own subclasses of RuntimeException.
SCJP, SCWCD
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
So my question: should I throw RecordNotFoundException ONLY if that condition happens?
I will mention in the documentation of my solution that the RecordNotFoundException could be also thrown for other reasons and explain how to determine the exact reason and leave it at that.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
The hill is not a hill.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP, SCWCD
The hill is not a hill.
Beauty is in the eye of the tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|