added modules error msg
This commit is contained in:
@@ -13,6 +13,7 @@ using static CMS_CORE_Library.Models.DataStructures;
|
||||
using static Thermo.Active.Config.ServerConfig;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
using Thermo.Active.Model.DTOModels.Recipe;
|
||||
using Thermo.Active.Utils;
|
||||
|
||||
namespace Thermo.Active.Controllers.WebApi
|
||||
{
|
||||
@@ -27,11 +28,17 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
return NotFound();
|
||||
{
|
||||
ThermoActiveLogger.LogError($"NC Not connected! | GetCurrentModules | {libraryError.exception}");
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
CmsError cmsError = ncAdapter.ReadModulesBlock(out Dictionary<int, DTOModulesBlock> currModules);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}");
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
}
|
||||
|
||||
return Ok(currModules);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user