Merge pull request #130 from robbieaverill/pulls/4.7/exceptions

ENH Replace E_USER_ERROR errors with exceptions
This commit is contained in:
Guy Marriott 2020-10-04 16:58:15 -07:00 committed by GitHub
commit 8f40ddb5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -147,11 +147,13 @@ class Report extends ViewableData
*/ */
public function sourceQuery($params) public function sourceQuery($params)
{ {
if ($this->hasMethod('sourceRecords')) { if (!$this->hasMethod('sourceRecords')) {
return $this->sourceRecords($params, null, null)->dataQuery(); throw new \RuntimeException(
} else { 'Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()'
user_error("Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()", E_USER_ERROR); );
} }
return $this->sourceRecords($params, null, null)->dataQuery();
} }
/** /**

View File

@ -75,7 +75,9 @@ abstract class ReportWrapper extends Report
$this->afterQuery(); $this->afterQuery();
return $query; return $query;
} else { } else {
user_error("Please override sourceQuery()/sourceRecords() and columns() in your base report", E_USER_ERROR); throw new \RuntimeException(
"Please override sourceQuery()/sourceRecords() and columns() in your base report"
);
} }
} }