Currently, I am working in an Angular 2 front-end environment with Node.js as the backend. One of my component classes is making calls to a DataService that communicates with the Node backend. Unfortunately, when the Node backend returns a 500 error for error cases, the entire uncaught exception message is displayed in the browser developer console. To address this issue, I have added a catch block like shown below:
let productPromise: Promise<void> = this.dataService.getProduct()
.then((product: IProduct): void => {
//
//
})
.catch(function (data) {
//To implement
});
Although this catch block prevents the big uncaught exception from being printed on the console, it still displays the following message:
GET http://localhost:9000/api/products 500 (Internal Server Error)
We are planning to determine later what specific message should be shown on the UI. However, for now, we do not want the 500 error to be visible in the development console. How can I achieve this?