私は例外処理を担当するサービスレイヤーを持っています。例外を処理し、サービスレイヤーから応答オブジェクトを返す
サービスレイヤで例外を処理する必要があり、ビューに適切な例外メッセージを渡すにはどうすればよいですか。
class App_Service_Feed {
function create() {
//...
try {
$feed->getMapper->insert();
} catch (Zend_Db_Statement_Exception $e) {
//what do I return here?
} catch (Exception $e) {
//what do I return here?
}
}
}
私はいくつかの説明の応答オブジェクトを返すことを考えているので、私のコントローラではこれを操作します。
class App_Controller {
//...
$response = $service->create();
if($response->status) {
}
}
代わりに、私は...コントローラでの例外を処理するかどうかを
質問の素敵な説明は+1。 – amod