File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ async function getAllVersions(obj) {
228228 //Use _id for indexed query performance instead of @id
229229 const primeHexId = parseDocumentID ( primeID )
230230 rootObj = await db . findOne ( { "$or" :[ { "_id" : primeHexId } , { "__rerum.slug" : primeHexId } ] } )
231+ if ( ! rootObj ) {
232+ throw new Error ( `Root object with id '${ primeID } ' not found in database` )
233+ }
231234 } else {
232235 //primeID is undefined or null, cannot proceed
233236 throw new Error ( "Object has no valid history.prime value" )
Original file line number Diff line number Diff line change @@ -207,6 +207,9 @@ async function getAllVersions(obj) {
207207 //Use _id for indexed query performance instead of @id
208208 const primeHexId = parseDocumentID ( primeID )
209209 rootObj = await db . findOne ( { "$or" :[ { "_id" : primeHexId } , { "__rerum.slug" : primeHexId } ] } )
210+ if ( ! rootObj ) {
211+ throw new Error ( `Root object with id '${ primeID } ' not found in database` )
212+ }
210213 } else {
211214 //primeID is undefined or null, cannot proceed
212215 throw new Error ( "Object has no valid history.prime value" )
You can’t perform that action at this time.
0 commit comments