digitalmars.D.learn - multi catch
- Zarathustra <adam.chrapkowski gmail.com> Jul 26 2008
- Moritz Warning <moritzwarning web.de> Jul 26 2008
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Jul 26 2008
- Zarathustra <adam.chrapkowski gmail.com> Jul 26 2008
How to create few catches?
for example:
try{
...
}
catch(Object o){
...
}
catch(Exception e){
...
}
Jul 26 2008
On Sat, 26 Jul 2008 05:07:20 -0400, Zarathustra wrote:How to create few catches? for example: try{ ... } catch(Object o){ ... } catch(Exception e){ ... }
The syntax is ok, but catch(Exception) is never reached. because Object will also match Exceptions. I think the compiler will argue about that.
Jul 26 2008
"Zarathustra" <adam.chrapkowski gmail.com> wrote in message news:g6epg8$24r7$1 digitalmars.com...How to create few catches? for example: try{ ... } catch(Object o){ ... } catch(Exception e){ ... }
Always order your catches from most-derived to least-derived. So, try { .. } catch(Exception e) { .. } catch(Object o) { .. } That's what the "catch at foo hides catch at bar" means.
Jul 26 2008
Jarrett Billingsley Wrote:"Zarathustra" <adam.chrapkowski gmail.com> wrote in message news:g6epg8$24r7$1 digitalmars.com...How to create few catches? for example: try{ ... } catch(Object o){ ... } catch(Exception e){ ... }
Always order your catches from most-derived to least-derived. So, try { .. } catch(Exception e) { .. } catch(Object o) { .. } That's what the "catch at foo hides catch at bar" means.
Ok, thanks It's working.
Jul 26 2008









Moritz Warning <moritzwarning web.de> 