Fix photo uploading and add more detailed logging to deserialization

This commit is contained in:
Slendy 2023-02-24 20:17:44 -06:00
commit a2d2337dc3
No known key found for this signature in database
GPG key ID: 7288D68361B91428
2 changed files with 8 additions and 4 deletions

View file

@ -102,8 +102,9 @@ public static partial class ControllerExtensions
if (matchedRoot == null)
{
Logger.Error($"[{controller.ControllerContext.ActionDescriptor.ActionName}] " +
$"Failed to deserialize {typeof(T).Name}: Unable to match root element", LogArea.Deserialization);
Logger.Error($"{bodyString}", LogArea.Deserialization);
$"Failed to deserialize {typeof(T).Name}: Unable to match root element\n" +
$"xmlData: '{bodyString}'",
LogArea.Deserialization);
return default;
}
root = new XmlRootAttribute(matchedRoot);
@ -116,8 +117,10 @@ public static partial class ControllerExtensions
catch (Exception e)
{
Logger.Error($"[{controller.ControllerContext.ActionDescriptor.ActionName}] " +
$"Failed to deserialize {typeof(T).Name}: {e.Message}", LogArea.Deserialization);
Logger.Error($"{bodyString}", LogArea.Deserialization);
$"Failed to deserialize {typeof(T).Name}:\n" +
$"xmlData: '{bodyString}'\n" +
$"detailedException: '{e.ToDetailedException()}",
LogArea.Deserialization);
}
return default;
}

View file

@ -60,6 +60,7 @@ public class Photo
[XmlElement("plan")]
public string PlanHash { get; set; } = "";
[XmlIgnore]
public virtual ICollection<PhotoSubject> PhotoSubjects { get; set; } = new HashSet<PhotoSubject>();
public int CreatorId { get; set; }