4 ms·
You can abstract your try / catch logic to a higher level to fix this easily. make all promises extend from a base promise function that either returns a result
by zackify 9y ago
You can abstract your try / catch logic to a higher level to fix this easily. make all promises extend from a base promise function that either returns a result, or null (or an error, you can make it more complex). Then,
let data = await customPromise()
if(!data) return
this would be better in my opinion that try catch everywhere. Inside that higher order promise you can catch and handle errors.