Currently during initialization OBS will simply throw const char * for issues
|
if (!MakeUserDirs()) |
|
throw "Failed to create required user directories"; |
|
if (!InitGlobalConfig()) |
|
throw "Failed to initialize global config"; |
|
if (!InitLocale()) |
|
throw "Failed to load locale"; |
|
if (!InitTheme()) |
|
throw "Failed to load theme"; |
and run_program happens to know to catch those with
|
} catch (const char *error) { |
|
blog(LOG_ERROR, "%s", error); |
|
OBSErrorBox(nullptr, "%s", error); |
|
} |
This is both messy and also means that these errors can not be localized.
All of these potential errors during initialization should throw a proper exception type that identifies the kind of error with an optional error message for developers, then catch the specific type and display the localized error message appropriate for the error.
Currently during initialization OBS will simply
throw const char *for issuesobs-studio/frontend/OBSApp.cpp
Lines 1054 to 1061 in 085a51a
and
run_programhappens to know tocatchthose withobs-studio/frontend/obs-main.cpp
Lines 693 to 696 in 085a51a
This is both messy and also means that these errors can not be localized.
All of these potential errors during initialization should throw a proper exception type that identifies the kind of error with an optional error message for developers, then catch the specific type and display the localized error message appropriate for the error.