mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-26 22:56:23 -04:00
Added logging of json snippets on json deserialization errors.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Serializer;
|
||||
@@ -24,5 +25,31 @@ namespace NzbDrone.Libraries.Test.JsonTests
|
||||
|
||||
result.ShouldBeEquivalentTo(quality, o => o.IncludingAllRuntimeProperties());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_log_start_snippet_on_failure()
|
||||
{
|
||||
try
|
||||
{
|
||||
Json.Deserialize<object>("asdfl kasjd fsdfs derers");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.Message.Should().Contain("snippet '<--error-->asdfl kasjd fsdfs de'");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_log_line_snippet_on_failure()
|
||||
{
|
||||
try
|
||||
{
|
||||
Json.Deserialize<object>("{ \"a\": \r\n\"b\",\r\n \"b\": \"c\", asdfl kasjd fsdfs derers vsdfsdf");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.Message.Should().Contain("snippet ' \"b\": \"c\", asdfl <--error-->kasjd fsdfs derers v'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user