Announcement

Collapse
No announcement yet.

try...catch-Blöcke mit verschiedenen Exceptions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • try...catch-Blöcke mit verschiedenen Exceptions

    Hi...
    ich hoffe ich komme mal mit einer etwas einfacheren Frage...
    Natürlich fange ich wie jeder ordentliche Mensch auch brav meine Exceptions ab (so weit ich zumindest weiß)...leider hab ich jetzt einen Block, der sowohl eine Exception als auch eine SqlException haben kann...wie ist denn jetzt da die Syntax für meinen try...catch-Block ???
    Gruss Stefie

  • #2
    Hallo,
    versuch es mal mit der Angabe des Types:
    <pre>
    try {
    // Code
    }
    catch(SecurityException secException) {
    }
    catch(SqlException sqlException) {
    }
    catch(Exception exception) {
    // default für alle restlichen
    }
    catch(OtherException otherException) {
    // wird ignoriert, da bereits Exception berücksichtigt wurde
    }
    </pre&gt

    Comment


    • #3
      Hi Jörg...
      das ist ja echt einfach...einfach nen 2ten catch-Block hinter häng *ankopffass* da hätte ich ja glatt irgendwann noch mal selbst drauf kommen können...naja trotzdem vielen Dank...
      Gruss Stefi

      Comment

      Working...
      X