How to access error message in the front end sent by the server?

In my node backend, this is how I send the error message to the front end:

catch (err) {
    res.status(500).json("UNEXPECTED ERROR. Please try again later.");
  }

How do I access the error message in the backend? Is this correct?

catch (err) {
  err.response.data;
}