Closed kevinkyle4 closed 3 months ago
This is by design, but changing in abstract-level
2.0.0. Until then, do:
try {
await db.get('example')
} catch (err) {
if (err.code === 'LEVEL_NOT_FOUND') {
console.log('Not found')
}
}
Something like this should work:
let value = null
try {
value = await db.get('key')
} catch (err) {
if (err.type !== 'NotFoundError') {
throw err
}
}
above solved my issue. thanks
If I am trying to fetch a value by its key before the value exists in DB it throws a "Entry Not Found" error in browser which crashes app. How do I use .get() to return zero results if entry is not found like in MongoDB? Thanks