Skip to content

Improve settings string parse error message#2532

Merged
fenhl merged 2 commits into
OoTRandomizer:Devfrom
addisonfischer:fix/settings-string-parse-error-handler
Mar 7, 2026
Merged

Improve settings string parse error message#2532
fenhl merged 2 commits into
OoTRandomizer:Devfrom
addisonfischer:fix/settings-string-parse-error-handler

Conversation

@addisonfischer

Copy link
Copy Markdown

IndexError raised when a settings string index exceeds the available choices gives no context on which setting failed or why. Added bounds checks in the list and str type branches of update_with_settings_string() function to raise a descriptive ValueError instead.

Fixes #2380

Testing

Tested with both strings from the issue. Both now raise ValueError with the setting name and index.
Tested with a valid settings string generated from defaults and parses successfully with no error.

IndexError raised when a settings string index exceeds the available choices and gives no context on which setting failed. Added bounds checks in the list/str type branches of the update_with_settings_string() function to raise a descriptive ValueError instead.
@fenhl fenhl added Type: Bug Something isn't working Status: Needs Review Someone should be looking at it Component: Setting specific to setting(s) Component: Documentation Affects user-facing help messages or public API docs labels Mar 7, 2026

@fenhl fenhl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Welcome and thank you for the PR! Just one minor suggestion.

Comment thread Settings.py Outdated
Comment thread Settings.py Outdated
@fenhl fenhl added the Status: Waiting for Author Changes or response requested label Mar 7, 2026
@addisonfischer

Copy link
Copy Markdown
Author

Updated!

@fenhl fenhl removed Status: Waiting for Author Changes or response requested Status: Needs Review Someone should be looking at it labels Mar 7, 2026
@fenhl fenhl added this to the next milestone Mar 7, 2026
@fenhl fenhl merged commit 4dc93d9 into OoTRandomizer:Dev Mar 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation Affects user-facing help messages or public API docs Component: Setting specific to setting(s) Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve settings string parse error message

2 participants