File: Zend_Exception-Previous.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (47 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 24249 -->
<!-- Reviewed: no -->
<sect1 id="zend.exception.previous">
    <title>Vorherige Exceptions</title>

    <para>
        Seit Zend Framework 1.10 implementiert <classname>Zend_Exception</classname> die
        Unterstützung von <acronym>PHP</acronym> 5.3 für vorgerige Exceptions. Einfach gesagt, wenn
        man in einem <methodname>catch</methodname> ist, kann man eine neue Exception werfen welche
        auf die vorherige Exception referenziert, was wiederum hilft indem zusätzlicher Kontext
        angeboten wird wenn man debuggt. Indem diese Unterstützung im Zend Framework angeboten wird,
        ist der eigene Code jetzt vorwärts kompatibel mit <acronym>PHP</acronym> 5.3.
    </para>

    <para>
        Vorherige Exceptions werden als drittes Argument an den Contructor der Exceptions indiziert.
    </para>

    <example id="zend.exception.previous.example">
        <title>Vorherige Exceptions</title>

        <programlisting language="php"><![CDATA[
try {
    $db->query($sql);
} catch (Zend_Db_Statement_Exception $e) {
    if ($e->getPrevious()) {
        echo '[' . get_class($e)
            . '] hat die vorherige Exception von ['
            . get_class($e->getPrevious())
            . ']' . PHP_EOL;
    } else {
        echo '[' . get_class($e)
            . '] hat keine vorherige Exception'
            . PHP_EOL;
    }

    echo $e;
    // zeigt alle Exceptions beginnend mit der ersten geworfenen
    // Exception wenn vorhanden.
}
]]></programlisting>
    </example>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->