mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENH Replace E_USER_ERROR errors with exceptions
This commit is contained in:
parent
275a1bc7f4
commit
9b9e673e4b
@ -147,11 +147,13 @@ class Report extends ViewableData
|
||||
*/
|
||||
public function sourceQuery($params)
|
||||
{
|
||||
if ($this->hasMethod('sourceRecords')) {
|
||||
return $this->sourceRecords($params, null, null)->dataQuery();
|
||||
} else {
|
||||
user_error("Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()", E_USER_ERROR);
|
||||
if (!$this->hasMethod('sourceRecords')) {
|
||||
throw new \RuntimeException(
|
||||
'Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->sourceRecords($params, null, null)->dataQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,9 @@ abstract class ReportWrapper extends Report
|
||||
$this->afterQuery();
|
||||
return $query;
|
||||
} 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user