This commit is contained in:
2019-03-28 22:08:24 +00:00
parent 456bb0badd
commit 431c715890
4 changed files with 8 additions and 7 deletions

View File

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

View File

@@ -6,7 +6,7 @@ using System.Collections.Generic;
using AyaNova.Biz;
namespace AyaNova.Api.ControllerHelpers
namespace AyaNova.Biz
{

View File

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

View File

@@ -36,10 +36,10 @@ namespace AyaNova.Biz
/// <summary>
///
/// </summary>
/// <param name="errorType"></param>
/// <param name="errorCode"></param>
/// <param name="errorMessage"></param>
/// <param name="propertyName"></param>
void AddError(ValidationErrorType errorType, string propertyName = null, string errorMessage = null);
void AddError(ApiErrorCode errorCode, string propertyName = null, string errorMessage = null);
/// <summary>
///