From 431c7158903c6088e4c33206d2da6677a4441ef3 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 28 Mar 2019 22:08:24 +0000 Subject: [PATCH] --- devdocs/todo.txt | 2 +- .../{ControllerHelpers => biz}/ApiErrorCodeStockMessage.cs | 2 +- server/AyaNova/biz/BizObject.cs | 7 ++++--- server/AyaNova/biz/IBizObject.cs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) rename server/AyaNova/{ControllerHelpers => biz}/ApiErrorCodeStockMessage.cs (96%) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 8996e555..f9644253 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -8,7 +8,7 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ3NTgwMzg2IiwiZXhwIjoi 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 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/ApiErrorCodeStockMessage.cs b/server/AyaNova/biz/ApiErrorCodeStockMessage.cs similarity index 96% rename from server/AyaNova/ControllerHelpers/ApiErrorCodeStockMessage.cs rename to server/AyaNova/biz/ApiErrorCodeStockMessage.cs index 2c4b9c68..9e4eae05 100644 --- a/server/AyaNova/ControllerHelpers/ApiErrorCodeStockMessage.cs +++ b/server/AyaNova/biz/ApiErrorCodeStockMessage.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using AyaNova.Biz; -namespace AyaNova.Api.ControllerHelpers +namespace AyaNova.Biz { diff --git a/server/AyaNova/biz/BizObject.cs b/server/AyaNova/biz/BizObject.cs index 36474188..dad07ed7 100644 --- a/server/AyaNova/biz/BizObject.cs +++ b/server/AyaNova/biz/BizObject.cs @@ -58,10 +58,10 @@ namespace AyaNova.Biz } - public void AddError(ApiErrorCode errorType, string propertyName = null, string errorMessage = null) + public void AddError(ApiErrorCode errorCode, string propertyName = null, string errorMessage = null) { - _errors.Add(new ValidationError() { ErrorType = errorType, Message = errorMessage, Target = propertyName }); + _errors.Add(new ValidationError() { Code = errorCode, Message = errorMessage, Target = propertyName }); } public string GetErrorsAsString() @@ -75,7 +75,8 @@ namespace AyaNova.Biz var msg = e.Message; if (string.IsNullOrWhiteSpace(msg)) { - msg = e.ErrorType.ToString(); + //msg = e.ErrorType.ToString(); + msg=ApiErrorCodeStockMessage.GetMessage(e.Code); } sb.AppendLine($"Target: {e.Target} error: {msg}"); } diff --git a/server/AyaNova/biz/IBizObject.cs b/server/AyaNova/biz/IBizObject.cs index 52b3d95d..ea1bf9a9 100644 --- a/server/AyaNova/biz/IBizObject.cs +++ b/server/AyaNova/biz/IBizObject.cs @@ -36,10 +36,10 @@ namespace AyaNova.Biz /// /// /// - /// + /// /// /// - void AddError(ValidationErrorType errorType, string propertyName = null, string errorMessage = null); + void AddError(ApiErrorCode errorCode, string propertyName = null, string errorMessage = null); /// ///