Open ItsSimko opened 1 day ago
Make it if one value fails only that one defaults instead of all of them
from #34
The current implementation of numeric setting conversions in the codebase uses
float()
andint()
functions. However, these conversions can raise aValueError
if the settings contain invalid values, such as non-numeric strings. This can lead to unhandled exceptions and potentially crash the application or lead to unexpected behavior.To improve the robustness of the code, it is recommended to add error handling around these conversions. Implementing
try/except
blocks can catch theseValueError
exceptions and allow the program to handle them gracefully, such as by logging an error message or setting a default value.Action Items:
- Identify all instances where
float()
andint()
conversions are used for settings.- Wrap these conversions in
try/except
blocks.- Decide on a strategy for handling the exceptions, such as logging the error or using a fallback value.
- Implement the changes and test to ensure that the application handles invalid settings without crashing.
I created this issue for @ItsSimko from #33 (comment).
Tips and commands
The float() and int() conversions could raise ValueError if settings contain invalid values. Consider adding try/except blocks with appropriate error handling.
_Originally posted by @sourcery-ai[bot] in https://github.com/ClinicianFOCUS/FreeScribe/pull/33#discussion_r1825014447_