mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-11 21:35:32 +00:00
Merge pull request #3602 from overleaf/ta-entity-oerror
Use OError for Entity Not Found Errors GitOrigin-RevId: 847c631236eeae0d328fe3999125208f1304465e
This commit is contained in:
parent
8a6136efa7
commit
ecd42944ad
3 changed files with 17 additions and 5 deletions
|
@ -1,7 +1,9 @@
|
|||
import OError from '@overleaf/o-error'
|
||||
|
||||
export function findInTreeOrThrow(tree, id) {
|
||||
const found = findInTree(tree, id)
|
||||
if (found) return found
|
||||
throw new Error(`Entity not found with id=${id}`)
|
||||
throw new OError('Entity not found in tree', { entityId: id })
|
||||
}
|
||||
|
||||
export function findAllInTreeOrThrow(tree, ids) {
|
||||
|
|
16
services/web/package-lock.json
generated
16
services/web/package-lock.json
generated
|
@ -3220,9 +3220,19 @@
|
|||
}
|
||||
},
|
||||
"@overleaf/o-error": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-3.2.0.tgz",
|
||||
"integrity": "sha512-H2HjuzoRBKNDy3pEZnVt+Pa6gPZPEENALXzvJy99ijOE5z6iirUkp2EMP/NTPfvyfUPz32cY04Jn10jjVowerg=="
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-3.3.1.tgz",
|
||||
"integrity": "sha512-1FRBYZO0lbJ0U+FRGZVS8ou6RhEw3e2B86WW/NbtBw554g0h5iC8ESf+juIfPMU/WDf/JDIFbg3eB/LnP2RSow==",
|
||||
"requires": {
|
||||
"core-js": "^3.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.3.tgz",
|
||||
"integrity": "sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@overleaf/redis-wrapper": {
|
||||
"version": "2.0.0",
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"@babel/preset-env": "^7.12.7",
|
||||
"@babel/preset-react": "^7.12.7",
|
||||
"@overleaf/metrics": "^3.4.1",
|
||||
"@overleaf/o-error": "^3.2.0",
|
||||
"@overleaf/o-error": "^3.3.1",
|
||||
"@overleaf/redis-wrapper": "^2.0.0",
|
||||
"@pollyjs/adapter-node-http": "^4.2.1",
|
||||
"@pollyjs/core": "^4.2.1",
|
||||
|
|
Loading…
Add table
Reference in a new issue