Should be $e->getCode() instead of simply "null". If some exceptions define for any reason a code, you loose it here.