andeedee / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

Exceptions don't always give useful information #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make an error in a filter, for example "country = United States" (should be 
double equal ==)

What is the expected output? What do you see instead?
I expect to get an error that says

GAPI: Failed to request report data. Error: "Malformed filter syntax: country = 
United States"

But instead I get

GAPI: Failed to request report data. Error: "Array"

What version of the product are you using? On what operating system?
1.3 on Linux

Please provide any additional information below.

I suggest changing the exception code as follows:

if(substr($response['code'],0,1) == '2')
{
  return $this->reportObjectMapper($response['body']);
}
else if(isset($response['code']))
{
throw new Exception('GAPI: Failed to request report data. Error: "' . 
$response['body'] . '"');
}
else
{
  throw new Exception('GAPI: Failed to request report data. Error: "' . strip_tags($response) . '"');
}

Original issue reported on code.google.com by seamless...@gmail.com on 13 Oct 2010 at 7:16