As a Wikidata gadget developer I want to know what part of my input caused an error so that I can adjust my code and make successful edits as intended.
The following table summarizes the intended changes to error reports ("error code" and the English error message) in particular situations. WMDE team can find more details, including example input, in the internal working document: https://docs.google.com/spreadsheets/d/1NWvIlCGl23J62Ug08En2Uu-wVRRwx36p-ECZJ6T2fSE/edit#gid=0
Additionally, `error-context` field is to be added to error responses on PATCH routes. Its value is a JSON object. In PATCH error responses, error context is supposed to be a JSON Patch object that is relevant for an error.
<table>
<tr>
<th>Description</th>
<th>current error (code)</th>
<th>Intended error</th>
</tr>
<tr>
<td>incorrect JSON patch operation</td>
<td>`invalid-patch`</td>
<td> `invalid-patch-operation`
`incorrect JSON patch operation: {op}`</td>
</tr>
<tr>
<td>missing mandatory field in JSON patch (`op`, `path`, `value`, also `from` on copy/move patches)</td>
<td>`invalid-patch`</td>
<td>`missing-json-patch-field`
`Missing {field} in JSON patch`</td>
</tr>
<tr>
<td>Path not found on the resource (statement)</td>
<td>`cannot-apply-patch`</td>
<td>`patch-path-not-found`
`Path {path} not found on the resource`</td>
</tr>
<tr>
<td>JSON Patch test operation failed</td>
<td>`patch-test-failed`</td>
<td>`patch-test-failed`
`Test operation in the provided patch failed. At path {path} expected {expected}, actual: {is}`</td>
</tr>
<tr>
<td>Removing a required field
Missing required field in the value</td>
<td>`patched-statement-invalid`</td>
<td>`patched-statement-missing-field`
`Missing field {field} in the statement data after the changes`
</td>
</tr>
<tr>
<td>Not allowed value of a field</td>
<td>`patched-statement-invalid`</td>
<td>`patched-statement-invalid-value`
`Incorrect value of field {field}`
</td>
</tr>
<tr>
<td>Value does match not the data type of the property</td>
<td>`patched-statement-invalid`</td>
<td>`patched-statement-value-type-mismatch`
`Value of {path} does not match property data type after the changes.`
</td>
</tr>
</table>