This commit is contained in:
2019-03-29 19:46:38 +00:00
parent 161820c071
commit a77270e295
3 changed files with 26 additions and 21 deletions

View File

@@ -5,10 +5,14 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ3NTgwMzg2IiwiZXhwIjoi
## IMMEDIATE ITEMS
ValidationErrorTypes.cs is a parallel error code system to ApiErrorCode.cs that seems to originally be intended for form level field validation errors, however similar / same codes
are written into apierrorcode and I think it was intended to show textual errors to help developers, however numbers are easier to work with and it's crazy to have two different sets of api level errors for validation etc (and we already have a third set of codes for OPS level errors so two only would be best)
FIX ALL THE ERROR CODE SHIT AND REMOVE THE UNNECESSARY VALIDATIONERRORTYPES.CS
NEXT: ADD **ALL** apiErrorCodes to localized text docs, some new ones added are missing, specifically:
VALIDATION_CUSTOM_REQUIRED_EMPTY = 2204,
VALIDATION_MISSING_PROPERTY = 2205,
VALIDATION_NOT_UNIQUE = 2206,
VALIDATION_STARTDATE_AFTER_ENDDATE = 2207,
VALIDATION_REFERENTIAL_INTEGRITY = 2208,
VALIDATION_NOT_CHANGEABLE = 2209
Need a sprint to get to a fully testable client with entry form, list and as much as possible all features from COMMON-* specs list
Do the stuff in the Client todo first then back to the server as required.

View File

@@ -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; }

View File

@@ -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