frontend: Replace string-based exceptions with std::runtime_error#13412
frontend: Replace string-based exceptions with std::runtime_error#13412gundarapuashwin wants to merge 6 commits intoobsproject:masterfrom
Conversation
Replace raw const char* throws in initialization with proper std::runtime_error exceptions. This allows localization of error messages and follows C++ best practices. Fixes obsproject#13394
|
Please make sure to fill out each section of the pull request template. There are also some other string based exceptions within this file that were missed. |
Edited and fixed the contents you needed |
|
This is also missing the localization portion of the original Task issue. You can see the helper function Note since you're a new contributor, you only have to worry about updating en-US.ini with localization strings. Translations for other languages are automated. That being said, some of these errors are before the locale is initialized for the purposes of that helper, so it's gonna need some additional thought for tackling that. It may be that we need an initialization specific helper function that uses the Qt locale rather than the user chosen one from the ini. |
Replace hardcoded exception strings with localized versions using QTStr(). Add GetInitErrorString helper for errors that may occur before locale initialization.
done, please check it. |
98f0844 to
bede783
Compare
Replace raw const char* throws in initialization with proper std::runtime_error exceptions. This allows localization of error messages and follows C++ best practices.
Fixes #13394
Description
Replaced raw const char* throws in AppInit() with std::runtime_error exceptions. Updated the corresponding catch block in run_program() to catch std::exception instead of const char*.
Motivation and Context
Raw string exceptions cannot be localized and are considered messy error handling. Using proper C++ exception types allows future localization of error messages and follows modern C++ best practices.
How Has This Been Tested?
Ran clang-format-19 locally to ensure style compliance. CI builds are running across Ubuntu, macOS, and Windows platforms to verify compilation.
Types of changes- Bug fix (non-breaking change which fixes an issue)
Checklist: