Skip to content

Allow hand-polishing individual exceptions by overriding templates. Fix #37.#38

Merged
erikrose merged 2 commits into
mainfrom
erik/sprucing-exceptions
Feb 18, 2026
Merged

Allow hand-polishing individual exceptions by overriding templates. Fix #37.#38
erikrose merged 2 commits into
mainfrom
erik/sprucing-exceptions

Conversation

@erikrose
Copy link
Copy Markdown
Member

@erikrose erikrose commented Feb 2, 2026

Drop a file into generate_patches/templates parallel to an exception module from fastly_compute/exceptions, and you can add improved exception implementations there. Disable the generation of stock ones by passing their names in the generated_exception() call, e.g. generated_exceptions(omit=["SomeException", "SomeOtherException"]).

  • Move almost all templating into Jinja templates.
  • Break generated exception code into named chunks that can be omitted individually by a customizing template.
  • Slightly improve BufferLen exception as an example.

@erikrose erikrose force-pushed the erik/sprucing-exceptions branch from c59fb2f to a68f4eb Compare February 2, 2026 22:38
#37.

Drop a file into `generate_patches/templates` parallel to an exception module from `fastly_compute/exceptions`, and you can add improved exception implementations there. Disable the generation of stock ones by passing their names in the `generated_exception()` call, e.g. `generated_exceptions(omit=["SomeException", "SomeOtherException"])`.

* Move almost all templating into Jinja templates.
* Break generated exception code into named chunks that can be omitted individually by a customizing template.
* Slightly improve `BufferLen` exception as an example.
Base automatically changed from exception-fluency-monkeypatching to main February 3, 2026 16:08
@erikrose erikrose force-pushed the erik/sprucing-exceptions branch from b3d77ee to 9daab77 Compare February 3, 2026 21:38
This innately gives us diffs to look at, filling the role of tests.

Also...
* Make all but `patches.py` pass `ruff lint` and `ruff format`. (`ruff format` does complex line wrapping to `patches.py`.)
* Add interface-level docstrings to packages' `__init__.py`s. `Interface` becomes a `DocsHaver` to support this.
@erikrose erikrose mentioned this pull request Feb 17, 2026
@erikrose erikrose merged commit 87f875f into main Feb 18, 2026
4 checks passed
@erikrose erikrose deleted the erik/sprucing-exceptions branch March 31, 2026 20:58
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