CRM-13889 - CRM_Core_BAO_Dashboard - Fix test failure. Report error better.

Note: It looks like there was a merge error because some of the relevant
code was badly duplicated.
CRM-13889 - Autoformat
Merge pull request #2354 from totten/4.4-dashboard-api

CRM-13889 - CRM_Core_BAO_Dashboard - Fix test failure.