Skip to content

Commit

Permalink
fix: return 404 when updating a record that does not exist anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ShohanRahman committed Mar 25, 2024
1 parent d39e545 commit 99dea55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/resource-updater.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { scopeManager } from 'forest-express';
import createError from 'http-errors';
import { ErrorHTTP422 } from './errors';
import QueryOptions from './query-options';
import ResourceGetter from './resource-getter';
Expand Down Expand Up @@ -29,6 +30,8 @@ class ResourceUpdater {
} catch (error) {
throw new ErrorHTTP422(error.message);
}
} else {
throw createError(404, `The ${this._model.name} #${this._params.recordId} does not exist.`);
}

try {
Expand Down

0 comments on commit 99dea55

Please sign in to comment.