Skip to content

Improve error message for missing variables in ${VAR?err} syntax#1371

Open
philippedev101 wants to merge 1 commit intocontainers:mainfrom
philippedev101:patch-1
Open

Improve error message for missing variables in ${VAR?err} syntax#1371
philippedev101 wants to merge 1 commit intocontainers:mainfrom
philippedev101:patch-1

Conversation

@philippedev101
Copy link
Copy Markdown

When using Bash-style variable substitution with error enforcement (e.g., ${MY_VAR?Variable not set}), podman-compose raises a RuntimeError if the variable is missing.

Currently, this error only contains the custom error text provided in the string (e.g., "Variable not set"). It does not indicate which variable triggered the error. In large docker-compose.yml files with many required variables, this makes debugging impossible without modifying the source code.

This PR updates the RuntimeError to prepend the variable name to the error message.

  • Before: RuntimeError: Variable not set
  • After: RuntimeError: Variable 'OPENSEARCH_ADMIN_PASSWORD': Variable not set
Copy link
Copy Markdown
Collaborator

@p12tic p12tic left a comment

Choose a reason for hiding this comment

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

Looks good. Please add Signed-off-by line to commit message as indicated by failing test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants