From b67adf8789de18d060078da68f4d5b45bf557448 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 4 Jun 2019 22:48:03 -0400 Subject: [PATCH] properly parse error model --- src/Core/Models/Response/ErrorResponse.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Core/Models/Response/ErrorResponse.cs b/src/Core/Models/Response/ErrorResponse.cs index b8e1cafdf..bcfe650c6 100644 --- a/src/Core/Models/Response/ErrorResponse.cs +++ b/src/Core/Models/Response/ErrorResponse.cs @@ -27,9 +27,9 @@ namespace Bit.Core.Models.Response } if(errorModel != null) { - Message = errorModel.GetValue("Message", StringComparison.OrdinalIgnoreCase)?.Value(); - ValidationErrors = errorModel.GetValue("ValidationErrors", StringComparison.OrdinalIgnoreCase) - ?.Value>>(); + var model = errorModel.ToObject(); + Message = model.Message; + ValidationErrors = model.ValidationErrors; } else { @@ -60,5 +60,11 @@ namespace Bit.Core.Models.Response } return Message; } + + private class ErrorModel + { + public string Message { get; set; } + public Dictionary> ValidationErrors { get; set; } + } } }