charles-lunarg / vk-bootstrap

Vulkan Bootstrapping Iibrary
MIT License
820 stars 82 forks source link

Implement unwrap and expect error handling functions for Result. #186

Closed CodesOtakuYT closed 1 year ago

CodesOtakuYT commented 1 year ago
try {
        // Crash the program with the default error message if an error occured
        auto instance = instance_builder.use_default_debug_messenger().request_validation_layers().build().unwrap();
        // Crash the program with a custom error message if an error occured
        auto physical_device = vkb::PhysicalDeviceSelector(instance).select().expect("Couldn't select a suitable physical device");
        return EXIT_SUCCESS;
} catch (std::exception &e) {
        std::cerr << e.what() << std::endl;
        return EXIT_FAILURE;
}