properly parse error model

This commit is contained in:
Kyle Spearrin 2019-06-04 22:48:03 -04:00
parent 113eaef0d1
commit b67adf8789

View file

@ -27,9 +27,9 @@ namespace Bit.Core.Models.Response
} }
if(errorModel != null) if(errorModel != null)
{ {
Message = errorModel.GetValue("Message", StringComparison.OrdinalIgnoreCase)?.Value<string>(); var model = errorModel.ToObject<ErrorModel>();
ValidationErrors = errorModel.GetValue("ValidationErrors", StringComparison.OrdinalIgnoreCase) Message = model.Message;
?.Value<Dictionary<string, List<string>>>(); ValidationErrors = model.ValidationErrors;
} }
else else
{ {
@ -60,5 +60,11 @@ namespace Bit.Core.Models.Response
} }
return Message; return Message;
} }
private class ErrorModel
{
public string Message { get; set; }
public Dictionary<string, List<string>> ValidationErrors { get; set; }
}
} }
} }