Harmonize JSON API error messages

This commit is contained in:
2026-08-25 23:44:26 +02:00
parent 0d4b159ab3
commit f1b90a4d83
18 changed files with 254 additions and 175 deletions
+18 -13
View File
@@ -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);
}
}