We have a well-defined error handler, as we saw in the previous section, so we can now write meaningful error messages that will help you with troubleshooting and make sure that sensitive information is not exposed.
Error messages will depend on the type of application you are coding for. As an example, think about what kind of error message you would like to see to help you solve an issue or understand what is happening.
We will apply some ideas and you can then go further and improve the error messages for the order-api application.
First, we will change the order.ts controller file, as follows:
import { NextFunction, Request, Response } from 'express'import * as halson from 'halson'import * as _ from 'lodash'import { OrderModel ...