diff --git a/docs/8.0/ayanova/docs/api-response-format.md b/docs/8.0/ayanova/docs/api-response-format.md index f61cc0bc..a2008932 100644 --- a/docs/8.0/ayanova/docs/api-response-format.md +++ b/docs/8.0/ayanova/docs/api-response-format.md @@ -125,7 +125,7 @@ Here is an example of a more detailed error response showing validation errors o { "message": "255 max", "target": "Name", - "error": "LengthExceeded" + "error": "2202" }, { "target": "EndDate", @@ -147,7 +147,7 @@ The above example shows multiple validation errors ([API error code](api-error-c `target` property shows the location of the error. The value of `target` is either a property name corresponding to the property that failed business rule validation or blank if the validation rule applies to the entire object in general. -`error` property contains the exact [validation error](api-validation-error-codes.md). +`error` property contains the exact [api validation error code](api-error-codes.md). `message` property optionally contains further information of use to the developer, in the example above you can see that the name property has more than the maximum limit of 255 characters. @@ -219,4 +219,4 @@ Internal server errors are returned with an HTTP Status Code of 500 and an error For security reasons no details of an internal server exception are returned, you must examine the [server log](common-log.md) to see the details. Generally this means the request triggered an unhandled exception which will be logged in detail to the log file. -Please report any internal server errors (preferrably with the log showing the exception details) to AyaNova support so we can look into it. +Please report any unexpected internal server errors (preferrably with the log showing the exception details) to AyaNova support so we can look into it. diff --git a/docs/8.0/ayanova/docs/api-validation-error-codes.md b/docs/8.0/ayanova/docs/api-validation-error-codes.md deleted file mode 100644 index 36aabd9e..00000000 --- a/docs/8.0/ayanova/docs/api-validation-error-codes.md +++ /dev/null @@ -1,17 +0,0 @@ -# API VALIDATION ERROR CODES - -All the validation error codes that can be [returned](api-response-format.md) by the API server. -In each case there may be more details in the `message` property where appropriate. - -| CODE | MEANING | -| ----- | ------------------------------ | -| RequiredPropertyEmpty | An AyaNova fixed rule required property value is empty | -| CustomRequiredPropertyEmpty | A user customized form property set to required has an empty value | -| RequiredPropertyMissing | Required property is missing entirely | -| LengthExceeded | A text property has more characters than are allowed. The limit will be returned in the `message` property of the validation error | -| NotUnique | A text property is required to be unique but an existing 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 | diff --git a/docs/8.0/ayanova/mkdocs.yml b/docs/8.0/ayanova/mkdocs.yml index 4a56367c..c7614826 100644 --- a/docs/8.0/ayanova/mkdocs.yml +++ b/docs/8.0/ayanova/mkdocs.yml @@ -36,5 +36,4 @@ pages: - 'API request format': 'api-request-format.md' - 'API response format': 'api-response-format.md' - 'API error codes': 'api-error-codes.md' - - 'API validation error codes': 'api-validation-error-codes.md' - 'API upload routes': 'api-upload-routes.md' diff --git a/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs b/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs index abc944aa..019503e8 100644 --- a/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs +++ b/server/AyaNova/ControllerHelpers/ApiErrorResponse.cs @@ -128,7 +128,7 @@ namespace AyaNova.Api.ControllerHelpers Error.Details = new List(); foreach (ValidationError v in errors) { - Error.Details.Add(new ApiDetailError() { Target = v.Target, Message = v.Message, Error = v.Code.ToString() }); + Error.Details.Add(new ApiDetailError() { Target = v.Target, Message = v.Message, Error = ((int)v.Code).ToString() }); } log.LogDebug("BadRequest - Validation error"); }