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

Time:02-10

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;
}

CodePudding user response:

  •  Tags:  
  • Related