Question · NestJS course · Module 6: Error Handling and Monitoring

Error.captureStackTrace

What is the purpose of Error.captureStackTrace(this, this.constructor) in a Custom Exception?

Answer options

  • Records the stack trace showing where the exception was thrown, skipping the constructor itself
  • Encrypts the stack trace for security
  • Deletes the stack trace from memory
  • Sends the stack trace to an external service

You can check the correct answer by solving this task in the CodeWorlds game.