You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve error handling when retrieving models within the get_model method and signals to prevent disruptions in platform processes such as course enrollments when the model is not present in the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting.
Description
Currently, when making a request using the get_model method and the specified model does not exist, an exception is raised, logging the error here: Link to Code.
However, within the signal handling process, the method *Model*.objects.get is used to retrieve models. If the model is missing from the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting, it throws a AttributeError: 'NoneType' object has no attribute 'objects'” exception, as the process does not terminate gracefully. This forces the model to be explicitly included in the configuration, leading to interruptions in critical platform processes like course enrollments (Link to Signals).
Suggested Enhancement
The current behavior mandates that models must exist in the configuration. Failure to do so results in unhandled exceptions that break the natural flow of platform operations. To enhance robustness:
Graceful Fallback: Implement a more graceful fallback mechanism in the case where the model is not found. Instead of raising a hard exception, log the error and allow the process to continue where possible.
Soft Error Handling: Adjust the plugin's behavior to report such errors without crashing core functionalities of the platform, allowing the default platform behavior to continue unaffected.
This improvement will ensure that platform processes like enrollments do not get disrupted, even if the plugin configuration is incomplete.
Steps to Reproduce
Remove CourseEnrollment from the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting.
Attempt to enroll a user through any part of the platform.
Observe the thrown exception and the resulting error message.
Expected Behavior
If the model is not found, log the error and continue the process without causing a crash.
Enrollment or other platform processes should continue unaffected by missing model configurations within the plugin.
Actual Behavior
An exception is raised (AttributeError: 'NoneType' object has no attribute 'objects'”) when 2024-08-26 21:56:16,853 ERROR 1 [platform_plugin_aspects.utils] [user None] [ip None] utils.py:218 - Unable to find model config for course_enrollment, which stops the process and prevents course enrollments from completing.
Proposed Fix
Update the error handling logic in both the get_model method and signal processing to ensure proper error reporting without breaking core platform functionalities.
Environment
Platform version: Redwood
Plugin version: v0.11.1
The text was updated successfully, but these errors were encountered:
Issue Type: Enhancement
Summary
Improve error handling when retrieving models within the
get_model
method and signals to prevent disruptions in platform processes such as course enrollments when the model is not present in the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting.Description
Currently, when making a request using the
get_model
method and the specified model does not exist, an exception is raised, logging the error here: Link to Code.However, within the signal handling process, the method
*Model*.objects.get
is used to retrieve models. If the model is missing from the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting, it throws aAttributeError: 'NoneType' object has no attribute 'objects'”
exception, as the process does not terminate gracefully. This forces the model to be explicitly included in the configuration, leading to interruptions in critical platform processes like course enrollments (Link to Signals).Suggested Enhancement
The current behavior mandates that models must exist in the configuration. Failure to do so results in unhandled exceptions that break the natural flow of platform operations. To enhance robustness:
This improvement will ensure that platform processes like enrollments do not get disrupted, even if the plugin configuration is incomplete.
Steps to Reproduce
CourseEnrollment
from the EVENT_SINK_CLICKHOUSE_MODEL_CONFIG setting.Expected Behavior
Actual Behavior
AttributeError: 'NoneType' object has no attribute 'objects'”
) when2024-08-26 21:56:16,853 ERROR 1 [platform_plugin_aspects.utils] [user None] [ip None] utils.py:218 - Unable to find model config for course_enrollment
, which stops the process and prevents course enrollments from completing.Proposed Fix
get_model
method and signal processing to ensure proper error reporting without breaking core platform functionalities.Environment
The text was updated successfully, but these errors were encountered: