Error.stackTraceLimit

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The Error.stackTraceLimit property gets or sets the stack trace limit, which is equivalent to the number of error frames to display. The default limit is 10.

Syntax

Error.stackTraceLimit   

Remarks

You can set the stackTraceLimit property to any positive value between 0 and Infinity. If the stackTraceLimit property is set to 0 at the time an error is thrown, no stack trace is shown. If the property is set to a negative value or a non-numeric value, the value is converted to 0. If the stackTraceLimit is set to Infinity, the entire stack is shown. Otherwise, ToUint32 is used to convert the value.

Example

The following example shows how to set and then get the stack trace limit.

try {  
  var err = new Error("my error");  
  Error.stackTraceLimit = 7;  
  throw err;  
} catch(e) {  
  document.write("Error stack trace limit: ")  
  document.write(Error.stackTraceLimit);  
}  

Requirements

Supported in Internet Explorer 10 and in Windows 8.x Store apps.

Applies ToError Object

See also