Skip to content

Migrate string-based exceptions during initialization to localized error codes/types #13394

@Warchamp7

Description

@Warchamp7

Currently during initialization OBS will simply throw const char * for issues

obs-studio/frontend/OBSApp.cpp

Lines 1054 to 1061 in 085a51a

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions