ExceptionクラスのgetTrace()を使うとエラーの呼び元が分かる

<?php
try {
 $this->_aaa();
} catch(Exception $e) {
 print_r($e->getTrace());
}
function _aaa() {
    throw new Exception();
}

結果

Array
(
    [0] => Array
        (
            [file] => /home/test.php
            [line] => 48
            [function] => _aaa
            [class] => Test
            [type] => ->
            [args] => Array
                (
                )

        )

    [1] => Array
        (
            [file] => /home/cake.php
            [line] => 370
            [function] => main
            [class] => Test
            [type] => ->
            [args] => Array
                (
                )

        )

getTrace()の返す一つ目の要素の[line]に$this->_aaa()の行数が入るためどの呼び元でエラーが出たのかが分かって便利。