Article View: borland.public.jbuilder.java.language
Article #18194Q: Exception Handling, "DataSetException"
From: Bob Hayden
Date: Mon, 27 Jul 1998 00:00
Date: Mon, 27 Jul 1998 00:00
58 lines
2126 bytes
2126 bytes
Hello,
Another question about something completely different... How can I
propagate an exception through an event handler? Each time I do
something to my dataset I have to write try..catch blocks for
"DataSetException". What I would like to do is throw this exception for
now, but if I throw it then I have problems back in init where the event
handler was declared. As I recall, this is a nested class so is it
possible to still handle this exception in the main class (and not the
nested subclass)? Here is an example of my code:
//////////////////////////////////////////////////
// Here is what I usually write to make it work...
//////////////////////////////////////////////////
void jbInit() throws Exception {
button5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button5_actionPerformed(e);
}
});
}
void button5_actionPerformed(ActionEvent e) {
try{
dsTestPlan.deleteRow();
}
catch ( DataSetException ex ) { }
}
///////////////////////////////
// This is what I want to do...
////////////////////////////////
void jbInit() throws Exception {
// How do I deal with the thrown exception here ???
button5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button5_actionPerformed(e);
}
});
}
void button5_actionPerformed(ActionEvent e) throws DataSetException{
dsTestPlan.deleteRow();
}
Thanks,
-Bob
(nospam measures... delete "nospam" from address to reply directly)
Technical Details
Message-ID:
<35BCBE43.91B1DCA2@nospam.ljpc.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,dc066737af5b6b1a,start X-Google-Attributes: gidf74b3,public From: Bob Hayden <bob@nospam.ljpc.com> Subject: Q: Exception Handling, "DataSetException" Date: 1998/07/27 Message-ID: <35BCBE43.91B1DCA2@nospam.ljpc.com> X-Deja-AN: 375372650 Content-Transfer-Encoding: 7bit Organization: La Jolla Pharmaceutical Company Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language