This commit is contained in:
@@ -10,8 +10,9 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// </summary>
|
||||
public class ApiDetailError
|
||||
{
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Code { get; internal set; }
|
||||
/* WAIT, why does this have CODE AND Error??! */
|
||||
// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
// public string Code { get; internal set; }
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Message { get; internal set; }
|
||||
|
||||
@@ -111,8 +111,8 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
msg += "Exception: " + m.Exception.Message;
|
||||
}
|
||||
//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() });
|
||||
//
|
||||
Error.Details.Add(new ApiDetailError() { Target = key, Message = msg, Error = ((int)ApiErrorCode.VALIDATION_INVALID_VALUE).ToString() });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,21 +135,21 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
|
||||
|
||||
|
||||
public void AddDetailError(ApiErrorCode apiCode, string target = null, string message = null)
|
||||
{
|
||||
if (Error.Details == null)
|
||||
{
|
||||
Error.Details = new List<ApiDetailError>();
|
||||
}
|
||||
// public void AddDetailError(ApiErrorCode apiCode, string target = null, string message = null)
|
||||
// {
|
||||
// if (Error.Details == null)
|
||||
// {
|
||||
// Error.Details = new List<ApiDetailError>();
|
||||
// }
|
||||
|
||||
//try to get a stock message if nothing specified
|
||||
if (message == null)
|
||||
{
|
||||
message = ApiErrorCodeStockMessage.GetMessage(apiCode);
|
||||
}
|
||||
// //try to get a stock message if nothing specified
|
||||
// if (message == null)
|
||||
// {
|
||||
// message = ApiErrorCodeStockMessage.GetMessage(apiCode);
|
||||
// }
|
||||
|
||||
Error.Details.Add(new ApiDetailError() { Code = ((int)apiCode).ToString(), Target = target, Message = message });
|
||||
}
|
||||
// Error.Details.Add(new ApiDetailError() { Code = ((int)apiCode).ToString(), Target = target, Message = message });
|
||||
// }
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user