From a77270e295822529bf01079a024a15f9fc2eb667 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 29 Mar 2019 19:46:38 +0000 Subject: [PATCH] --- devdocs/todo.txt | 12 +++++--- .../ControllerHelpers/ApiDetailError.cs | 5 ++-- .../ControllerHelpers/ApiErrorResponse.cs | 30 +++++++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index f9644253..5dd67327 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -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. diff --git a/server/AyaNova/ControllerHelpers/ApiDetailError.cs b/server/AyaNova/ControllerHelpers/ApiDetailError.cs index 5a8f2752..34fad005 100644 --- a/server/AyaNova/ControllerHelpers/ApiDetailError.cs +++ b/server/AyaNova/ControllerHelpers/ApiDetailError.cs @@ -10,8 +10,9 @@ namespace AyaNova.Api.ControllerHelpers /// 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; } diff --git a/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs b/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs index 019503e8..4ac4c870 100644 --- a/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs +++ b/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs @@ -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(); - } + // public void AddDetailError(ApiErrorCode apiCode, string target = null, string message = null) + // { + // if (Error.Details == null) + // { + // Error.Details = new List(); + // } - //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