I received a 500 error recently on a PATCH call to update a template. The error response is shown below with the template ID obfuscated)
Upon retrying the exact same request shortly after, the PATCH then succeeded.
I’d like to be able to prevent this issue in the future, in addition to being able to catch it and handle correctly.
- Can anyone say why this particular error occured, so I can attempt to avoid it in the future?
- If it does occur and there’s no harm in simply repeating the call quickly, is this an appropriate way to handle instances of this error?
{
"errors": r
{
"id": "eaf13aaf-5e7a-4c89-b522-35382b0fe1e1",
"status": 500,
"code": "error",
"title": null,
"detail": "(1062, \"Duplicate entry 'XXXXXX' for key 'app_templatedefinition.template_id'\")",
"source": {
"pointer": "/data"
},
"links": {},
"meta": {}
}
]
}