digitalmars.D.learn - multi catch
- Zarathustra (11/11) Jul 26 2008 How to create few catches?
- Moritz Warning (4/15) Jul 26 2008 The syntax is ok, but catch(Exception) is never reached.
- Jarrett Billingsley (7/18) Jul 26 2008 Always order your catches from most-derived to least-derived. So,
- Zarathustra (2/25) Jul 26 2008 Ok, thanks It's working.
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...Ok, thanks It's working.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