模拟gcoud计算引擎API中的错误

I've setup a server that starts, stops and lists gcloud compute engine instances. I am using PHP to do that. As with all the things on the internet, errors may occur. I am looking for a away to simulate errors. Maybe gcloud won't respond for 30s (such event would be really bad and I don't really know if they have a timeout set on their web server). Or the start of the instance fails for some reason.. How can I simulate this real life problems? I haven't found much about simulating compute engine API errors on google.

This is the relevant PHP code.

startInstance($project,$instance,$zone);

function stopInstance($g_project,$g_instance, $g_zone){

    $client = new Google_Client();
    $client->setApplicationName('Google-ComputeSample/0.1');
    $client->useApplicationDefaultCredentials();
    $client->addScope('https://www.googleapis.com/auth/cloud-platform');

    $service = new Google_Service_Compute($client);
    $response = $service->instances->stop($g_project, $g_zone, $g_instance);
    echo json_encode($response);

}
function startInstance($g_project,$g_instance, $g_zone){

    $client = new Google_Client();
    $client->setApplicationName('Google-ComputeSample/0.1');
    $client->useApplicationDefaultCredentials();
    $client->addScope('https://www.googleapis.com/auth/cloud-platform');

    $service = new Google_Service_Compute($client);
    $response = $service->instances->start($g_project, $g_zone, $g_instance);
    echo json_encode($response);

}
function listInstances($g_project,$g_instance, $g_zone){
    $client = new Google_Client();
    $client->setApplicationName('Google-ComputeSample/0.1');
    $client->useApplicationDefaultCredentials();
    $client->addScope('https://www.googleapis.com/auth/cloud-platform');

    $service = new Google_Service_Compute($client);
    $response = $service->instances->listInstances(DEFAULT_PROJECT, DEFAULT_ZONE_NAME);
    echo json_encode($response);  
}