Skip to content

Commit

Permalink
Adds failOnError on the example
Browse files Browse the repository at this point in the history
  • Loading branch information
ajimix committed Oct 24, 2018
1 parent f5c6c06 commit 6f5a0f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/report-errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// See class comments and Asana API for full info
$asana = new Asana(array('personalAccessToken' => 'xxxxxxxxxxxxxxxxxxxxx')); // Create a personal access token in Asana or use OAuth

$asana->failOnError = false; // Disable failing on API return codes >= 400
$taskId = 5555555555; // Something invalid to provoke an error
$asana->getTask($taskId);

Expand All @@ -14,7 +15,7 @@
foreach ($errors as $key => $error) {
$key++;
echo "Error $key: " . $error->message . '<br />'; // The error details, such as "task: Not a recognized ID: 5555555555"
echo "Details: " . $error->help . '<br />'; // Details, which seems to just link to the getting-started/errors documentation
echo 'Details: ' . $error->help . '<br />'; // Details, which seems to just link to the getting-started/errors documentation
}
return;
}
Expand Down

0 comments on commit 6f5a0f9

Please sign in to comment.