Skip to content

feat(runfiles): add CreateOrRaise API - #4028

Queued
rickeylev wants to merge 2 commits into
bazel-contrib:mainfrom
rickeylev:add_runfiles_raise_api
Queued

feat(runfiles): add CreateOrRaise API#4028
rickeylev wants to merge 2 commits into
bazel-contrib:mainfrom
rickeylev:add_runfiles_raise_api

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

Currently, Runfiles.Create returns None when runfiles environment
variables ($RUNFILES_MANIFEST_FILE and $RUNFILES_DIR) are unset or
empty, requiring callers to write repetitive None checks and handle
missing runfiles manually.

This adds Runfiles.CreateOrRaise and module-level CreateOrRaise, which
return the initialized Runfiles instance or raise a RuntimeError if
runfiles cannot be found.

Currently, Runfiles.Create returns None when runfiles environment
variables ($RUNFILES_MANIFEST_FILE and $RUNFILES_DIR) are unset or
empty, requiring callers to perform repetitive None checks.

This adds Runfiles.CreateOrRaise and module-level CreateOrRaise, which
return the instantiated runfiles object or raise a RuntimeError if
runfiles cannot be found.
@rickeylev
rickeylev requested a review from aignas as a code owner August 9, 2026 07:53
@rickeylev
rickeylev requested a review from dougthor42 August 9, 2026 08:08
@rickeylev
rickeylev added this pull request to the merge queue Aug 9, 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.

2 participants