This commit is contained in:
2019-03-28 21:47:48 +00:00
parent f0806f9c73
commit aad30d0da0
4 changed files with 12 additions and 15 deletions

View File

@@ -0,0 +1,37 @@
using System;
using Microsoft.Extensions.Logging;
using AyaNova.Models;
using System.Linq;
using System.Collections.Generic;
namespace AyaNova.Biz
{
public enum ApiErrorCode : int
{
/*
DON'T FORGET TO UPDATE THE API-ERROR-CODES.MD DOCUMENTATION
AND UPDATE THE ApiErrorCodeStockMessage.cs
*/
API_CLOSED = 2000,
API_OPS_ONLY = 2001,
API_SERVER_ERROR = 2002,
AUTHENTICATION_FAILED = 2003,
NOT_AUTHORIZED = 2004,
CONCURRENCY_CONFLICT=2005,
NOT_FOUND = 2010,
PUT_ID_MISMATCH = 2020,
INVALID_OPERATION = 2030,
VALIDATION_FAILED = 2200,
VALIDATION_REQUIRED = 2201,
VALIDATION_LENGTH_EXCEEDED = 2202,
VALIDATION_INVALID_VALUE = 2203
}
}//eons

View File

@@ -58,7 +58,7 @@ namespace AyaNova.Biz
}
public void AddError(ValidationErrorType errorType, string propertyName = null, string errorMessage = null)
public void AddError(ApiErrorCode errorType, string propertyName = null, string errorMessage = null)
{
_errors.Add(new ValidationError() { ErrorType = errorType, Message = errorMessage, Target = propertyName });

View File

@@ -6,11 +6,11 @@ namespace AyaNova.Biz
Now_api_code_2201_RequiredPropertyEmpty = 1,
Now_api_code_2202_LengthExceeded = 2,
Now_api_code_2206_NotUnique = 3,
StartDateMustComeBeforeEndDate = 4,
InvalidValue = 5,
ReferentialIntegrity = 6,
InvalidOperation = 7,
NotChangeable=8,
Now_api_code_2207_StartDateMustComeBeforeEndDate = 4,
Now_api_code_2203_InvalidValue = 5,
Now_api_code_2208_ReferentialIntegrity = 6,
Now_api_code_2030_InvalidOperation = 7,
Now_api_code_2209_NotChangeable=8,
Now_api_code_2205_RequiredPropertyMissing = 9,
Now_api_code_2204_CustomRequiredPropertyEmpty = 10