Skip to content

feat: tell if each thrown exception was caught - #129

Merged
lcottercertinia merged 1 commit into
mainfrom
feat/exception-caught
Oct 16, 2026
Merged

lcottercertinia merged 1 commit into
mainfrom
feat/exception-caught

Conversation

@lukecotter

@lukecotter lukecotter commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

📝 Overview

Tell if each thrown exception was caught. A consumer that reports what failed in a transaction needs this fact. Today it must read it off the raw events itself.

🛠️ Changes

  • Add isCaught: boolean | null to the details of each EXCEPTION_THROWN event. It is the parser's reading of the row after the throw; the log does not state it.
    • A FATAL_ERROR gives false. Any other row gives true, so a finally block that logs before a FATAL_ERROR reads true.
    • Throws with only exit lines between them share one answer, so a throw that a catch block wraps and throws again is false too.
    • The log end, a limit block (CUMULATIVE_LIMIT_USAGE, LIMIT_USAGE_FOR_NS, TESTING_LIMITS, CUMULATIVE_PROFILING_BEGIN) or dropped lines give null.
  • engine/throws.ts reads every decided throw in one pass, on the first read. EventLines holds the result for its log. The scan does not change.
  • Fix: a max-size issue that moves to a closed frame now keeps where the dropped part starts (Issues.replace). Without it, a throw before a max-size cut read true.
  • Details and Caught terms in CONTEXT.md. The README and .changeset/v1.md say what details holds.

🧩 Type of change

  • 🐛 Bug fix — fixes an issue
  • ✨ Feature — adds new functionality
  • ♻️ Refactor — no behaviour change
  • ⚡ Performance
  • 📝 Docs
  • 🔧 Chore — tooling, CI, deps
  • 💥 Breaking change

🔗 Related issues

Part of #123 (caught).

✅ Checklist

  • Tests added/updated
  • pnpm run ci passes locally
  • Changeset added (pnpm changeset) if this affects the published package
  • Docs updated if behaviour or the public API changed

@lukecotter
lukecotter force-pushed the feat/exception-caught branch from dcc5b64 to de5fc2f Compare October 10, 2026 12:00
@lcottercertinia lcottercertinia mentioned this pull request Oct 11, 2026
3 of 11 tasks
Base automatically changed from feat/v1 to main October 15, 2026 16:46
lcottercertinia added a commit that referenced this pull request Oct 15, 2026
## 📝 Overview

v1: the new parser becomes the package root, and the legacy parser is
removed. This PR is stacked on #124. It merges after the v0.3 release.

## 🛠️ Changes

- Remove the legacy parser, its tests and the legacy side of the compare
tool.
- Move `src/next` to `src/`. The exports are now `.` (node build for the
`node` condition, else browser) and `./worker`. `./next` and
`./next/worker` are removed.
- Record the legacy parser's `bench:large` figures as the baseline
(`benchmarks/baselines/legacy-v0.3.json`).
- Remove every comment that describes a rule against the legacy parser.
- Rewrite the README, AGENTS.md and CONTRIBUTING.md for v1.
- Add a major changeset with the full list of breaking changes.

Performance against v0.3, on logs of 8 to 100 MB: 5–8× faster, with 6×
less memory. A 100 MB log parses in 182 ms instead of 1,215 ms, and
holds 141 MB instead of 812 MB.

Consumer check: debug-log-analyzer migrated locally (2548/2548 tests,
build), and checked by hand in the Extension Development Host. A 100 MB
log parses in about 220 ms in the webview.

## 🧩 Type of change

- [ ] 🐛 Bug fix — fixes an issue
- [x] ✨ Feature — adds new functionality
- [ ] ♻️ Refactor — no behaviour change
- [x] ⚡ Performance
- [x] 📝 Docs
- [ ] 🔧 Chore — tooling, CI, deps
- [x] 💥 Breaking change

## 🔗 Related issues

Stacked on #124.

Closes #34: `ofType` gives typed per-type indexes, and `events` an
iterative walk of every event.
Closes #35: every type has a `kind`, and SOSL has its own kind apart
from SOQL.
Closes #37: the new parser is the package root, and the legacy parser is
removed.
Closes #71: the catalog names every event's fields, and `EventFields`
documents each one.
Closes #123: `details.caught` on each throw (#129), and `flowErrors`
with the `FLOW_ELEMENT_ERROR` text change (#128). Both merge into this
branch first.
Closes #127: `DEBUG_CATEGORY_TOKEN` is exported from the package root.

## ✅ Checklist

- [x] Tests added/updated
- [x] `pnpm run ci` passes locally
- [x] Changeset added (`pnpm changeset`) if this affects the published
package
- [x] Docs updated if behaviour or the public API changed

---------

Co-authored-by: Luke Cotter <81575432+lcottercertinia@users.noreply.github.com>
@lukecotter
lukecotter force-pushed the feat/exception-caught branch from f265c8e to af4eb5c Compare October 15, 2026 16:59
@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing feat/exception-caught (bea7ec5) with main (c564955)

Open in CodSpeed

@lukecotter
lukecotter force-pushed the feat/exception-caught branch from af4eb5c to c316b67 Compare October 15, 2026 17:23
@lukecotter
lukecotter force-pushed the feat/exception-caught branch from c316b67 to 7e1eb5f Compare October 15, 2026 18:33
@lcottercertinia
lcottercertinia marked this pull request as ready for review October 15, 2026 22:17
@lukecotter
lukecotter force-pushed the feat/exception-caught branch 2 times, most recently from 39c17d5 to 5ca83c1 Compare October 16, 2026 08:55
Add `isCaught` to the details of each `EXCEPTION_THROWN` event. It is
the parser's reading of the row after the throw; the log does not state
it. A `FATAL_ERROR` gives false, any other row gives true, so a
`finally` block that logs before a `FATAL_ERROR` reads true. Throws
with only exit lines between them share one answer, so a throw that a
catch block wraps and throws again is false too. The log end, a limit
block (including `TESTING_LIMITS`) or dropped lines give null.

engine/throws.ts reads the outcome of every decided throw in one pass,
on the first read, and EventLines holds the result for its log. The
scan does not change.

A max-size issue that moves to a closed frame now keeps where the
dropped part starts, so a throw before a max-size cut reads null.

Refs #123
@lukecotter
lukecotter force-pushed the feat/exception-caught branch from 5ca83c1 to bea7ec5 Compare October 16, 2026 08:58
@lcottercertinia
lcottercertinia merged commit d9d3abb into main Oct 16, 2026
10 checks passed
@lcottercertinia
lcottercertinia deleted the feat/exception-caught branch October 16, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants