Harmonize JSON API error messages
This commit is contained in:
+18
-13
@@ -278,12 +278,12 @@ class Feed extends PhpObject {
|
||||
$sWeatherIcon = 'unknown';
|
||||
}
|
||||
|
||||
//Get Condition ID
|
||||
$sCondKey = (new Translator(self::WEATHER_PARAM['lang']))->getTranslationKey($sWeatherCond);
|
||||
//Get Condition Language ID
|
||||
$sCondLangId = (new Translator(self::WEATHER_PARAM['lang']))->getTranslationKey($sWeatherCond);
|
||||
|
||||
return array(
|
||||
'weather_icon' => $sWeatherIcon,
|
||||
'weather_cond' => $sCondKey,
|
||||
'weather_cond' => $sCondLangId,
|
||||
'weather_temp' => floatval($sWeatherTemp)
|
||||
);
|
||||
}
|
||||
@@ -318,16 +318,21 @@ class Feed extends PhpObject {
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$asResult = array();
|
||||
if($this->getFeedId() > 0) {
|
||||
$asResult = array(
|
||||
'id' => $this->getFeedId(),
|
||||
'del' => $this->oDb->deleteRow(self::FEED_TABLE, $this->getFeedId()),
|
||||
'desc' => $this->oDb->getLastError()
|
||||
);
|
||||
}
|
||||
else $asResult = array('del'=>false, 'desc'=>'Error while setting project: no Feed ID');
|
||||
$bSuccess = false;
|
||||
$sLangId = '';
|
||||
$asLangParams = array();
|
||||
$asData = array();
|
||||
|
||||
return $asResult;
|
||||
if($this->getFeedId() > 0) {
|
||||
$asData['id'] = $this->getFeedId();
|
||||
$bSuccess = $this->oDb->deleteRow(self::FEED_TABLE, $this->getFeedId());
|
||||
if(!$bSuccess) $sLangId = 'error.commit_db';
|
||||
}
|
||||
else {
|
||||
$sLangId = 'error.impossible_value';
|
||||
$asLangParams = array($this->getFeedId(), 'feed ID');
|
||||
}
|
||||
|
||||
return Livetrail::getResult($bSuccess, $sLangId, $asData, $asLangParams);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user