EXAMPLE 06 • errors.ts

Thrown Errors & Symbolized Stack Traces

An error thrown from inlined code inside an outlined block, called through a runtime helper, from an inlined caller. DevTools rebuilds the authored stack trace.

Inlined Ranges Inside an Outlined FunctionOutlined Function (isHidden + definition)Runtime Helper Without Definition (dropped)Outlined Owner Inlined Into Its Caller
OPEN CHROME DEVTOOLS (F12) FIRST, THEN TRIGGER:
Ready. Click "Throw Uncaught Error" with DevTools open.

How This Example Works

The RangeError is thrown in _outlinedUsingBlock (the outlined using block of reserveOrder, with reserveLine and assertValidQuantity inlined into it). It is called through the runtime helper __using, from submitOrder, which in turn has reserveOrder inlined.

The raw err.stack only knows the generated frames. DevTools should expand inlined frames, merge the outlined block into its owner, drop the helper, and show each authored frame once.

What to Try & Verify in DevTools

Error Stack Traces

Try:Click Catch & console.error() and expand the error in the Console.

  • Stack: assertValidQuantity (6) → reserveLine (11) → reserveOrder (21) → submitOrder (27) → submitOrderAndReport (33), all linking to errors.ts.
  • No generated frames: _outlinedUsingBlock and __using are not shown, and reserveOrder shows up exactly once.
  • Raw vs. symbolized: the page readout shows the raw err.stack with bundle.js frames. Only DevTools symbolizes it.
Error Stack Traces

Try:Click Throw Uncaught Error.

  • Stack: Uncaught RangeError with assertValidQuantity (6) → reserveLine (11) → reserveOrder (21) → submitOrder (27) → anonymous timer callback (41).
  • Async part: setTimeout → submitOrderLater (41). window.runExample06 is not shown.
Call Stack

Try:In Sources › Breakpoints, enable Pause on uncaught exceptions and click Throw Uncaught Error again (or enable Pause on caught exceptions and use the other button).

  • Paused on line 6 of errors.ts. The Call Stack matches the Console stack trace.
  • Select reserveOrder: Scope shows Block lock, and orderId <unavailable>, sku: "SKU-B", quantity: 0, reserved: 0.
  • Select submitOrder: units is <unavailable> (not assigned yet).
Other things to try
  • Right-click the stack trace in the Console or Call Stack › Copy stack trace.
  • Add bundle.js to the ignore list, or toggle the source map scopes experiment, and compare the stack traces.
  • Close DevTools, click both buttons, then open DevTools: the already-logged errors should still get symbolized.
  • While paused on the exception, use Restart frame on reserveOrder or submitOrder.

Not sure if it's a DevTools bug? Tab 4. Decoded Scopes shows what the source map actually encodes.

Try in the Console While Paused

While paused, select a frame and evaluate these in the Console (Esc opens the drawer) using the authored names:

`${sku} x ${quantity}`
Expected Result: "SKU-B x 0"
Paused on the throw (step 3), with any frame from assertValidQuantity to submitOrder selected.
orderId
Expected Result: ReferenceError with reserveOrder selected; "ORD-17" with submitOrder selected
The outlined block does not receive orderId (it is <unavailable> in the Scope pane), so there is nothing to evaluate. The submitOrder frame still has it.