This commit is contained in:
@@ -98,7 +98,7 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
//var vErrors = modelState.Keys.SelectMany(key => modelState[key].Errors);
|
||||
foreach (var key in modelState.Keys)
|
||||
{
|
||||
var vErrors=modelState[key].Errors;
|
||||
var vErrors = modelState[key].Errors;
|
||||
foreach (ModelError m in vErrors)
|
||||
{
|
||||
string msg = "";
|
||||
@@ -110,8 +110,9 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
msg += "Exception: " + m.Exception.Message;
|
||||
}
|
||||
|
||||
Error.Details.Add(new ApiDetailError() { Code = ((int)ApiErrorCode.VALIDATION_FAILED).ToString(), Target = key, Message = msg, Error=ApiErrorCode.VALIDATION_FAILED.ToString() });
|
||||
//example this produces
|
||||
//{"error":{"code":"2200","details":[{"code":"2200","message":"Exception: Error converting value \"\" to type 'AyaNova.Biz.AuthorizationRoles'. Path 'roles', line 1, position 146.","target":"roles","error":"VALIDATION_FAILED"}],"message":"Object did not pass validation"}}
|
||||
Error.Details.Add(new ApiDetailError() { Code = ((int)ApiErrorCode.VALIDATION_FAILED).ToString(), Target = key, Message = msg, Error = ApiErrorCode.VALIDATION_INVALID_VALUE.ToString() });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user