Merge pull request #3602 from overleaf/ta-entity-oerror

Use OError for Entity Not Found Errors

GitOrigin-RevId: 847c631236eeae0d328fe3999125208f1304465e
This commit is contained in:
Miguel Serrano
2021-01-28 03:04:42 +00:00
committed by Copybot
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) {