Bird
0
0

Which of these is the correct way to report an error manually in a Node.js app to GCP Error Reporting?

easy📝 Syntax Q3 of 15
GCP - Cloud Monitoring and Logging
Which of these is the correct way to report an error manually in a Node.js app to GCP Error Reporting?
Aconsole.log('Error: Failure');
Bprocess.exit(1);
Cthrow new Error('Failure');
Dconst errors = require('@google-cloud/error-reporting'); errors.report(new Error('Failure'));
Step-by-Step Solution
Solution:
  1. Step 1: Identify the Error Reporting client usage

    The '@google-cloud/error-reporting' library provides a report method to send errors manually.
  2. Step 2: Exclude incorrect methods

    console.log only logs locally, throw creates an error but doesn't report, process.exit stops the app.
  3. Final Answer:

    Use '@google-cloud/error-reporting' and call report() -> Option D
  4. Quick Check:

    Manual error reporting = Use error-reporting client [OK]
Quick Trick: Use the error-reporting client library to report errors manually [OK]
Common Mistakes:
  • Using console.log instead of report()
  • Throwing errors without reporting
  • Exiting process to signal error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes