<?php
class A
{
function run()
{
throw new Exception("Common error", 42);
}
}
class B
{
/**
* @var $a A
*/
public $a;
function run()
{
try {
$this->a->run();
} catch (Exception $exception) {
if ($exception->getCode() == 42) {
throw new RuntimeException("Custom error");
}
}
}
}