Check asserts and replace with RaiseError where appropriate #10776

Open
opened 2025-12-29 21:35:49 +01:00 by adam · 0 comments
Owner

Originally created by @arthanson on GitHub (Feb 18, 2025).

Proposed Changes

There are several places in the code where asserts are used (cables.py, events, bulk_views). There should be a code review of the places where asserts are used in the codebase and replaced where appropriate with a raised error.

Justification

Asserts are removed when not running in debug mode. It was noticed in the cabling code that the asserts were used in places where actually errors should have been raised to catch it in production environments. So an code review should be done on all these usages and make sure an assert is appropriate or if a RaiseError should be used.

Originally created by @arthanson on GitHub (Feb 18, 2025). ### Proposed Changes There are several places in the code where asserts are used (cables.py, events, bulk_views). There should be a code review of the places where asserts are used in the codebase and replaced where appropriate with a raised error. ### Justification Asserts are removed when not running in debug mode. It was noticed in the cabling code that the asserts were used in places where actually errors should have been raised to catch it in production environments. So an code review should be done on all these usages and make sure an assert is appropriate or if a RaiseError should be used.
adam added the type: housekeepingstatus: backlog labels 2025-12-29 21:35:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10776