Exception handling

<?php

//any method can throw an error
function methodWithException() {
    throw new Exception("test exception");
}