1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

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)
{
Message = errorModel.GetValue("Message", StringComparison.OrdinalIgnoreCase)?.Value<string>();
ValidationErrors = errorModel.GetValue("ValidationErrors", StringComparison.OrdinalIgnoreCase)
?.Value<Dictionary<string, List<string>>>();
var model = errorModel.ToObject<ErrorModel>();
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<string, List<string>> ValidationErrors { get; set; }
}
}
}