Skip to content

fix: a miss in a T!E function with a non-String E stops the program - #1404

Merged
kacy merged 1 commit into
mainfrom
fix-typed-error-index-miss
Nov 15, 2026
Merged

kacy merged 1 commit into
mainfrom
fix-typed-error-index-miss

Conversation

@kacy

@kacy kacy commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Fixes #1400.

Inside a T! function, an index miss, a map key miss, .value() on none, or a bad xs[i] = v fails the function with a String message. The emitter did this for every fallible function, so a T!E function with a struct E returned that String where an E belonged. Reading a field of the error then crashed.

Misses now fail the function only when its error type is T! or T!String. With any other E they stop the program with the usual runtime error, as they do outside a fallible function. Inside an isolated HTTP or gRPC handler that fails the request, which covers generated gRPC handlers (Resp!grpc.GrpcError).

  • New abort goldens cover the index, key and .value() cases.
  • docs/idiomatic_pith.md describes the rule.
  • The local suite passes, including the leak, rc and memcheck targets.

@kacy
kacy merged commit 067f614 into main Nov 15, 2026
4 checks passed
@kacy
kacy deleted the fix-typed-error-index-miss branch November 15, 2026 16:19
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.

an index miss inside a T!E function propagates a malformed E

1 participant