how do I trigger error on front end from the back end?

I’m trying to trigger an error catch block from the back end to the front end

backend
if mongoose.findById(wrongId) = null

if (null) {
return new Error('not found')
}
do not continue with code below


front end
try {
 async 
  await = something(wrongId)
} catch (err) {
do something
}