异常处理

<?php

class Seller {
    public $cars = [];

    public function sell() {
        if (count($this->cars) == 0) {
            throw new Exception("No cars for sale");
        }
        //some implementation...
    }        
}

$seller = new Seller();
try {
    $seller->sell(); //<-Error 
}
catch (Exception $e) {
    echo $e->getMessage();
    //e->getMessage() is "No cars for sale"
}