diff --git a/src/api/routes/article.js b/src/api/routes/article.js index cbb4f1c..5bd443a 100644 --- a/src/api/routes/article.js +++ b/src/api/routes/article.js @@ -71,7 +71,8 @@ function articleErrorStatus(error) { if (error.message === 'Invalid categoryIds') return 400; if (error.message === 'Attribute name not found') return 404; if (error.message === 'attributeNameId is required to become a father article') return 400; - if (error.message === 'A child article cannot become a father') return 400; + if (error.message?.includes('already used by an ancestor father')) return 400; + if (error.message?.includes('cannot have attribute values for its variant attribute')) return 400; if (error.message === 'Cannot disable father mode on an article that still has children') return 400; if (error.message === 'Article is not a father article') return 400; if (error.message === 'Attribute value is required for child article' || error.message === 'Attribute value is required') return 400; diff --git a/src/api/routes/articleattributevalue.js b/src/api/routes/articleattributevalue.js index 23d1fbe..0df7968 100644 --- a/src/api/routes/articleattributevalue.js +++ b/src/api/routes/articleattributevalue.js @@ -27,6 +27,7 @@ function articleAttributeValueErrorStatus(error) { if (error.message === 'Company not found' || error.message === 'Article not found') return 404; if (error.message?.startsWith('Attribute value not found')) return 404; if (error.message?.includes('exclusive')) return 400; + if (error.message?.includes('father article') || error.message?.includes('Child article must have')) return 400; if (error.message === 'Invalid attribute values array' || error.message === 'Invalid attributeValueId' || error.message === 'Duplicate attributeValueId') return 400; return 500; }