hasError() public method

Checks for errors in the response.
public hasError ( ) : boolean
return boolean
<?php

require_once '../asana.php';
// See class comments and Asana API for full info
$asana = new Asana(array('apiKey' => 'XXXXXXXXXXXXXXXXXXX'));
// Your API Key, you can get it in Asana
$workspaceId = 'XXXXXXXXXXXXXXXXXXX';
// The workspace where we want to create our task, take a look at getWorkspaces() method.
// First we create the task
$asana->createTask(array('workspace' => $workspaceId, 'name' => 'Hello World!', 'assignee' => '*****@*****.**'));
// As Asana API documentation says, when a task is created, 201 response code is sent back so...
if ($asana->hasError()) {
    echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
    return;
}
$result = $asana->getData();
if (isset($result->id)) {
    echo $result->id;
    // Here we have the id of the task that have been created
}