This commit is contained in:
@@ -26,6 +26,6 @@ Here are all the API level error codes that can be returned by the API server:
|
|||||||
| 2204 | Validation error - Customized form property set to required has an empty value |
|
| 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 |
|
| 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 |
|
| 2206 | Validation error - A text property is required to be unique but an existing record with an identical value was found in the database |
|
||||||
| 2207 | Validation error - When an object requires a start and end date the start date must be earlier than the end date |
|
| 2207 | Validation error - 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 |
|
| 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 |
|
| 2209 | Validation error - Indicates the attempted property change is invalid because the value is fixed and cannot be changed |
|
||||||
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using AyaNova.Biz;
|
||||||
|
|
||||||
|
|
||||||
namespace AyaNova.Api.ControllerHelpers
|
namespace AyaNova.Api.ControllerHelpers
|
||||||
@@ -19,10 +20,20 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
return "API Closed";
|
return "API Closed";
|
||||||
case ApiErrorCode.API_OPS_ONLY:
|
case ApiErrorCode.API_OPS_ONLY:
|
||||||
return "API Closed to non operations routes";
|
return "API Closed to non operations routes";
|
||||||
|
case ApiErrorCode.API_SERVER_ERROR:
|
||||||
|
return "Server internal error, details in server log file";
|
||||||
|
case ApiErrorCode.AUTHENTICATION_FAILED:
|
||||||
|
return "Authentication failed";
|
||||||
|
case ApiErrorCode.NOT_AUTHORIZED:
|
||||||
|
return "User not authorized for this resource operation (insufficient rights)";
|
||||||
case ApiErrorCode.CONCURRENCY_CONFLICT:
|
case ApiErrorCode.CONCURRENCY_CONFLICT:
|
||||||
return "Object was changed by another user since retrieval (concurrency token mismatch)";
|
return "Object was changed by another user since retrieval (concurrency token mismatch)";
|
||||||
case ApiErrorCode.NOT_FOUND:
|
case ApiErrorCode.NOT_FOUND:
|
||||||
return "Object not found";
|
return "Object not found";
|
||||||
|
case ApiErrorCode.PUT_ID_MISMATCH:
|
||||||
|
return "Update failed: ID mismatch - route ID doesn't match object id";
|
||||||
|
case ApiErrorCode.INVALID_OPERATION:
|
||||||
|
return "An attempt was made to perform an invalid operation";
|
||||||
case ApiErrorCode.VALIDATION_FAILED:
|
case ApiErrorCode.VALIDATION_FAILED:
|
||||||
return "Object did not pass validation";
|
return "Object did not pass validation";
|
||||||
case ApiErrorCode.VALIDATION_REQUIRED:
|
case ApiErrorCode.VALIDATION_REQUIRED:
|
||||||
@@ -31,14 +42,21 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
return "Field too long";
|
return "Field too long";
|
||||||
case ApiErrorCode.VALIDATION_INVALID_VALUE:
|
case ApiErrorCode.VALIDATION_INVALID_VALUE:
|
||||||
return "Field is set to a non allowed value";
|
return "Field is set to a non allowed value";
|
||||||
case ApiErrorCode.AUTHENTICATION_FAILED:
|
case ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY:
|
||||||
return "Authentication failed";
|
return "Customized form property set to required has an empty value";
|
||||||
case ApiErrorCode.PUT_ID_MISMATCH:
|
case ApiErrorCode.VALIDATION_MISSING_PROPERTY:
|
||||||
return "Update failed: ID mismatch - route ID doesn't match object id";
|
return "Required property is missing entirel";
|
||||||
case ApiErrorCode.INVALID_OPERATION:
|
case ApiErrorCode.VALIDATION_NOT_UNIQUE:
|
||||||
return "An attempt was made to perform an invalid operation";
|
return "Field is required to be unique but an existing record with an identical value was found in the database";
|
||||||
case ApiErrorCode.NOT_AUTHORIZED:
|
case ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE:
|
||||||
return "User not authorized for this resource operation (insufficient rights)";
|
return "The start date must be earlier than the end date";
|
||||||
|
case ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY:
|
||||||
|
return "Modifying the object (usually a delete) would break the link to other records in the database and operation was disallowed to preserve data integrity";
|
||||||
|
case ApiErrorCode.VALIDATION_NOT_CHANGEABLE:
|
||||||
|
return "the value is fixed and cannot be changed";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -46,10 +64,26 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
VALIDATION_FAILED = 2200,
|
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_REQUIRED = 2201,
|
||||||
VALIDATION_LENGTH_EXCEEDED = 2202,
|
VALIDATION_LENGTH_EXCEEDED = 2202,
|
||||||
VALIDATION_INVALID_VALUE = 2203
|
VALIDATION_INVALID_VALUE = 2203,
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,34 @@ namespace AyaNova.Biz
|
|||||||
VALIDATION_FAILED = 2200,
|
VALIDATION_FAILED = 2200,
|
||||||
VALIDATION_REQUIRED = 2201,
|
VALIDATION_REQUIRED = 2201,
|
||||||
VALIDATION_LENGTH_EXCEEDED = 2202,
|
VALIDATION_LENGTH_EXCEEDED = 2202,
|
||||||
VALIDATION_INVALID_VALUE = 2203
|
VALIDATION_INVALID_VALUE = 2203,
|
||||||
|
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
|
||||||
|
/*
|
||||||
|
|
||||||
|
| 2000 | API closed - Server is running but access to the API has been closed to all users |
|
||||||
|
| 2001 | API closed all non OPS routes - Server is running but access to the API has been restricted to only server maintenance operations related functionality |
|
||||||
|
| 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). 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 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 |
|
||||||
|
| 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 | */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
public class ValidationError
|
public class ValidationError
|
||||||
{
|
{
|
||||||
public ValidationErrorType ErrorType { get; set; }
|
public ApiErrorCode Code { get; set; }
|
||||||
public string Target { get; set; }
|
public string Target { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user