Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inner Errors (exceptions) in JavaScript

Tags:

Is there a preferred way to include inner exceptions when throwing exceptions in JavaScript?

I'm relatively new to JavaScript coming from a C# background. In C#, you can do the following:

try 
{
  // Do stuff
}
catch (Exception ex)
{
  throw new Exception("This is a more detailed message.", ex);
}

In the samples I've seen in JavaScript, I haven't been able to find how to catch an exception, add a new message, and re-throw the new exception while still passing the original exception.