Error Handling
This section provides details about common error messages returned by the API, their causes, and recommended resolutions. Proper error handling ensures smooth integration and better debugging during development.
Error Codes and Messages
Validation Errors
Validation errors occur when the input data does not meet the schema constraints or formatting rules.
Sync Errors
Sync errors specifically relate to attribute data type constraints. Below is a list of sync errors, causes, and resolutions.
Error Message | Cause | Resolution |
---|---|---|
{field.RealFieldName}'s value exceeded the max size {field.CharacterMaximumLength} | The provided value for a varchar attribute exceeds the maximum character limit. | Check the maximum length allowed for the field in the schema and ensure the input meets the requirement. |
{field.RealFieldName}'s value exceeded the max integer part size {integerPartSize} | The integer part of a decimal attribute exceeds the allowed size. | Verify the integer size limit and provide a smaller value within the allowed range. |
{field.RealFieldName}'s value exceeded the max fractional part size {fractionalPartLength} | The fractional part of a decimal attribute exceeds the allowed size. | Adjust the decimal precision to meet the specified fractional limit. |
The value you provided for updating '{fieldMeta.RealFieldName}' attribute is invalid. Please refer to the documentation. | The value provided for any attribute type is invalid or improperly formatted. | Review the field requirements in the schema and validate the input format before submission. |
Error Handling Examples
Example Error Response
{
"error": {
"code": 400,
"message": "'exampleField's value exceeded the max size 255"
}
}
Handling Errors in Code
JavaScript Example
fetch('/api/update', {
method: 'POST',
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/json' },
})
.then(response => {
if (!response.ok) {
return response.json().then(err => {
console.error(`Error: ${err.message}`);
});
}
return response.json();
})
.then(data => console.log('Update successful:', data))
.catch(error => console.error('Unexpected Error:', error));
Schema Definitions
For details about field constraints, such as maximum lengths for varchar and decimal attributes, refer to the Schema Definitions section:
- Varchar Attributes: Maximum length specified in
CharacterMaximumLength
. - Decimal Attributes: Integer and fractional parts defined by
integerPartSize
andfractionalPartLength
.
Best Practices
- Validate Inputs Before Submission – Perform client-side validation to ensure field lengths and formats are correct.
- Use Sample Requests – Refer to provided examples for constructing valid payloads.
- Test API Requests – Utilize tools like Postman or cURL to test and debug API requests.