Skip to content

fix: chain sensor load errors as the previous release did - #377

Merged
kvlonge merged 1 commit into
mainfrom
fix/sensor-load-error-context
Nov 11, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/sensor-load-error-context

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Why

Sensor load errors raised from the native loader lost the exception chaining of the previous Python loader, so tracebacks no longer showed the import failure as context.

Changes

  • A sensor file that fails to import raises a SensorError whose context is the import error as well as its cause, as raise ... from error inside except did.
  • When an import error's message cannot be rendered, the original error stays the context of that failure, in both the sensor loader and provider discovery.
  • Sensor errors raised without a cause chain to the exception being handled.

Verification

make check-ci. A new regression test fails without the fix. Against 0.65.13, 18 sensor-loading cases (import, syntax, unprintable, base exceptions, decorator validation, name collisions, reserved names, unsupported events; each with and without an outer handler) and 8 provider cases match on error type, .args, cause, context, suppressed context and sys.path.

A sensor file that fails to import raises a SensorError whose context is
the import error as well as its cause, and an import error whose message
cannot be rendered stays the context of that failure, matching a Python
raise inside an except block. Sensor errors raised without a cause chain
to the exception being handled.
@kvlonge
kvlonge enabled auto-merge (squash) November 11, 2026 05:08
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sqltide with  Cloudflare Pages  Cloudflare Pages

Latest commit: eeb5170
Status: ✅  Deploy successful!
Preview URL: https://c7e2a800.sqltide.pages.dev
Branch Preview URL: https://fix-sensor-load-error-contex.sqltide.pages.dev

View logs

@kvlonge
kvlonge merged commit a2787b9 into main Nov 11, 2026
17 checks passed
@kvlonge
kvlonge deleted the fix/sensor-load-error-context branch November 11, 2026 05:27
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.

1 participant