-1

My requirement is to send the error to developers whenever an error occurs in the project (ex: unable to fetch the user from the database, var x is not defined, myfun() is not a function etc.)

We are using

  • NODE for backend language
  • Express for routing
  • GCP for deployment
  • PM2 package for management

Express default error handling is not working because we have many async codes, and it's very difficult to check and modify the project using express next() function.

I didn't find any way to report project error via GCP

and report error via pm2 is not working

Please tell me any third party package to report project errors or any other way of reporting.

hong4rc
  • 3,999
  • 4
  • 21
  • 40
Ankit Halder
  • 167
  • 1
  • 4
  • 16
  • Google Cloud has Stackdriver Error Reporting. Works very well when integrated into source code on the server side. Supports emailing users on error logs, etc. https://cloud.google.com/error-reporting/ – John Hanley Jan 12 '19 at 07:08
  • @JohnHanley thank you for you response can you provide proper steps and will it require to write code in project – Ankit Halder Jan 14 '19 at 16:56
  • Stackdriver Error Reporting is integrated into your source code (you manually add code). Google has good documentation on their website. – John Hanley Jan 14 '19 at 19:19

1 Answers1

0

User Stackdriver as already advised, and for Stackdriver to be useful, make sure that all errors are logged properly in your code, so that meaningful error messages are displayed in your Stackdriver reports.

Check this post for different methods of catching errors with Javascript, and how to deal with asynchronous calls.

alp
  • 642
  • 5
  • 13