Skip to content

Comments

Add functionality to raise error if block or include_block is not found in file#31

Merged
rnorth merged 8 commits intornorth:masterfrom
trinsic-id:block-throws
Feb 20, 2026
Merged

Add functionality to raise error if block or include_block is not found in file#31
rnorth merged 8 commits intornorth:masterfrom
trinsic-id:block-throws

Conversation

@geel9
Copy link
Contributor

@geel9 geel9 commented Aug 17, 2022

The current behavior for block and include_block is to return the full contents of the file if the block is not found. This is not optimal for our use case -- a block not being found is, to us, an error which should prevent the building of our docs site entirely.

This PR:

  • Adds a config option, block_throw, which defaults to false.
    • If false, behavior remains unchanged.
    • If true, the select() method will raise a ValueError if block or inside_block are not None, and the requested block is not found in the file.
  • Updates README.md
    • Explains behavior if block not found
    • Adds Configuration section detailing config options
  • Adds tests for new behavior

@fundthmcalculus
Copy link
Contributor

@rnorth any thoughts on this ticket?

Copy link
Owner

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks sensible - thanks @geel9 and sorry for taking a long time to get to this

@rnorth rnorth merged commit b85b8bf into rnorth:master Feb 20, 2026
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.

4 participants