mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 08:52:21 +00:00
FilterCmpt: return error when no db entries
This commit is contained in:
@@ -41,7 +41,14 @@ class Filter extends FHC_Controller
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
$this->outputJsonSuccess($this->filtercmptlib->getSession());
|
||||
$session = $this->filtercmptlib->getSession();
|
||||
if (is_object($session)) {
|
||||
// If stdClass it is an retval object
|
||||
if (isError($session))
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson($session);
|
||||
} else
|
||||
$this->outputJsonSuccess($session);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -176,6 +176,12 @@ class FilterCmptLib
|
||||
// Read the all session for this filter component
|
||||
$session = $this->getSession();
|
||||
|
||||
// Was there an error before?
|
||||
if (is_object($session)) {
|
||||
$this->_setSession(null);
|
||||
$session = null;
|
||||
}
|
||||
|
||||
// If session is NOT empty -> a filter was already loaded
|
||||
if ($session != null)
|
||||
{
|
||||
@@ -266,6 +272,11 @@ class FilterCmptLib
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_setSession(error('Entries in the DB missing!'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: latest operations to be performed in the session to be shure that they are always present
|
||||
|
||||
@@ -296,7 +296,9 @@ export const CoreFilterCmpt = {
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error(CoreRESTClient.getError(response));
|
||||
// NOTE(chris): this should never happen -> error should have been
|
||||
// catched before by the Fetch component.
|
||||
console.error(response.retval);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user