What is the purpose of the Error.cause property introduced in ES2022?

JavaScript Professional Hard

JavaScript Professional — Hard

What is the purpose of the Error.cause property introduced in ES2022?

Key points

  • Error.cause enables error chaining for preserving stack traces
  • Helps in identifying the root cause of an error
  • Prevents loss of context when handling errors

Ready to go further?

Related questions