Right way to catch all unexpected errors before they reach the user

Hi, I was wondering, what's the right way to catch all unexpected errors (like db errors) and replace them with simple "Internal Server Error" erros, before they get to the user. Is it possible to achieve this via middleware?
N
Nick470d ago
You can pass an error formatter when creating the tRPC server