Fixes for sonarr, we now display the error messages back to the user

This commit is contained in:
tidusjar 2016-04-07 20:38:36 +01:00
commit 10be8f0440
7 changed files with 55 additions and 16 deletions

View file

@ -24,8 +24,10 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nancy.Validation;
@ -55,5 +57,31 @@ namespace PlexRequests.UI.Helpers
})
.FirstOrDefault();
}
public static JsonResponseModel SendSonarrError(List<string> result)
{
var model = new JsonResponseModel {Result = false};
if (!result.Any())
{
return model;
}
var sb = new StringBuilder();
sb.AppendLine("Errors from Sonarr: ");
for (var i = 0; i < result.Count; i++)
{
if (i != result.Count - 1)
{
sb.AppendLine(result[i] + ",");
}
else
{
sb.AppendLine(result[i]);
}
}
model.Message = sb.ToString();
return model;
}
}
}