1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Web API: fixed missing initializations of error object (2)

This commit is contained in:
f4exb 2018-02-21 13:50:05 +01:00
parent 0162b1d2bc
commit 58086b422b
2 changed files with 8 additions and 23 deletions

View File

@ -1146,6 +1146,8 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
@ -1156,7 +1158,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1174,7 +1175,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1188,14 +1188,12 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
}
else
{
error.init();
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
@ -1209,6 +1207,8 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
@ -1219,7 +1219,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1234,7 +1233,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
.arg(*response.getChannelType())
.arg(channelIndex)
@ -1249,7 +1247,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1264,7 +1261,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
.arg(*response.getChannelType())
.arg(channelIndex)
@ -1275,16 +1271,13 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}

View File

@ -1251,6 +1251,8 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
{
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
@ -1261,7 +1263,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1279,7 +1280,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1293,14 +1293,12 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
}
else
{
error.init();
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
@ -1314,6 +1312,8 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
SWGSDRangel::SWGChannelSettings& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
{
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
@ -1324,7 +1324,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1339,7 +1338,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
.arg(*response.getChannelType())
.arg(channelIndex)
@ -1354,7 +1352,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
if (channelAPI == 0)
{
error.init();
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
@ -1369,7 +1366,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
.arg(*response.getChannelType())
.arg(channelIndex)
@ -1380,19 +1376,15 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
}
else
{
error.init();
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)