Exception handling

<?php

function MethodWithException() {
    try {
        throw new Exception("test exception");
    }
    catch (Exception $e) {
        //implementation of any partial processing
        //and send error to the calling code
        throw $e;
    }
}

try {
    MethodWithException();
}
catch (Exception $e) {
    echo $e->getMessage();
}