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

@@ -15,20 +15,17 @@ Here are all the API level error codes that can be returned by the API server:
| 2002 | Internal error from the API server, details in [server log](common-log.md) file |
| 2003 | Authentication failed, bad login or password, user not found |
| 2004 | Not authorized - current user is not authorized for operation attempted on the resource (insufficient rights) |
| 2005 | Object was changed by another user since retrieval (concurrency token mismatch) |
| 2005 | Object was changed by another user since retrieval (concurrency token mismatch). A record was attempted to be saved but another user has just modified it so it's invalid. (first save "wins") |
| 2010 | Object not found - API could not find the object requested |
| 2020 | PUT Id mismatch - object Id does not match route Id |
| 2030 | Invalid operation - operation could not be completed, not valid, details in message property |
| 2200 | Validation error - general top level indicating object was not valid, specifics in "details" property |
| 2200 | Validation error - general issue with object overall not valid, specifics in "details" property |
| 2201 | Validation error - Field is required but is empty or null |
| 2202 | Validation error - Field length exceeded. The limit will be returned in the `message` property of the validation error |
| 2203 | Validation error - invalid value. Usually an type mismatch or a logical or business rule mismatch (i.e. only certain values are valid for current state of object) |
| 2204 | Validation error - Customized form property set to required has an empty value |
| 2205 | Validation error - Required property is missing entirely. Usually a development or communications error |
| 2206 | Validation error - A text property is required to be unique but an existing record with an identical value was found in the database |
| StartDateMustComeBeforeEndDate | When an object requires a start and end date the start date must be earlier than the end date |
| InvalidValue | Generic error indicating an input object's property is not set correctly |
| ReferentialIntegrity | Indicates modifying the object (usually a delete) will break the link to other records in the database. The other records need to be modified before continuing |
| InvalidOperation | Indicates the operation is invalid, details provided in the `message` |
| NotChangeable | Indicates the attempted property change is invalid because the value is fixed and cannot be changed |
| 2207 | Validation error - When an object requires a start and end date the start date must be earlier than the end date |
| 2208 | Validation error - Modifying the object (usually a delete) would break the link to other records in the database and operation was disallowed to preserve data integrity |
| 2209 | Validation error - Indicates the attempted property change is invalid because the value is fixed and cannot be changed |

View File

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

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