Skip to content

fix: catch AttributeError in config check for non-dict WEBPACK_LOADER#433

Open
saschabuehrle wants to merge 1 commit intodjango-webpack:masterfrom
saschabuehrle:fix/issue-427
Open

fix: catch AttributeError in config check for non-dict WEBPACK_LOADER#433
saschabuehrle wants to merge 1 commit intodjango-webpack:masterfrom
saschabuehrle:fix/issue-427

Conversation

@saschabuehrle
Copy link

Bug

#427 — The webpack_cfg_check system check crashes with AttributeError: 'list' object has no attribute 'values' when WEBPACK_LOADER is set to a non-dict value (e.g. a list or None).

Fix

Added AttributeError to the existing except TypeError clause in webpack_cfg_check(). When WEBPACK_LOADER is a list, string, None, or any other non-dict type, calling .values() raises AttributeError instead of TypeError. By catching both, the function now correctly returns the BAD_CONFIG_ERROR diagnostic instead of crashing.

Testing

Verified that:

  • Non-dict configs (list, string, None) now return a BAD_CONFIG_ERROR check result instead of crashing
  • Valid dict configs continue to work as before
  • The existing TypeError path (dicts with non-dict values) still triggers correctly

Happy to address any feedback.

Greetings, saschabuehrle

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.

1 participant