Skip to content

Commit 41a6f49

Browse files
committed
send this immediately
The expressError handling was turning this into a text error with no payload, just a message
1 parent 478ffea commit 41a6f49

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

db-controller.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,11 +769,13 @@ const overwrite = async function (req, res, next) {
769769
const currentVersion = originalObject.__rerum?.isOverwritten ?? ""
770770

771771
if (expectedVersion !== undefined && expectedVersion !== currentVersion) {
772-
err = Object.assign(err, {
772+
res.status(409)
773+
res.json({
773774
message: `Version conflict detected. The object has been modified since your last read. Expected version: '${expectedVersion}', current version: '${currentVersion}'. Please fetch the latest version and try again.`,
774775
status: 409,
775-
currentVersion: currentVersion
776+
currentVersion
776777
})
778+
return
777779
}
778780
else {
779781
let context = objectReceived["@context"] ? { "@context": objectReceived["@context"] } : {}

0 commit comments

Comments
 (0)