Repository: microsoft/PowerToys
File: src/modules/colorPicker/ColorPicker/dllmain.cpp (C++)

Code before:

        settings.set_overview_link(L"https://aka.ms/PowerToysOverview_ColorPicker");

        return settings.serialize_to_buffer(buffer, buffer_size);
    }

    virtual void call_custom_action(const wchar_t* action) override
    {
    }

    virtual void set_config(const wchar_t* config) override
    {
        try
        {
            // Parse the input JSON string.
            PowerToysSettings::PowerToyValues values =
                PowerToysSettings::PowerToyValues::from_json_string(config, get_key());

            parse_hotkey(values);
            // If you don't need to do any custom processing of the settings, proceed
            // to persists the values calling:
            values.save_to_settings_file();
            // Otherwise call a custom function to process the settings before saving them to disk:
            // save_settings();
        }
        catch (std::exception& ex)
        {
            // Improper JSON.
        }
    }

    virtual void enable()
    {
        Logger::trace("ColorPicker::enable()");
        ResetEvent(send_telemetry_event);
        ResetEvent(m_hInvokeEvent);
        launch_process();
        m_enabled = true;
    };

    virtual void disable()
    {
        Logger::trace("ColorPicker::disable()");
        if (m_enabled)
        {
            ResetEvent(send_telemetry_event);
            ResetEvent(m_hInvokeEvent);
            TerminateProcess(m_hProcess, 1);
        }

        m_enabled = false;

Review comment (bug):
```suggestion
        catch (std::exception&)
```

Hi, thank you for the contribution! CI has failed to build  https://dev.azure.com/ms/PowerToys/_build/results?buildId=368631&view=logs&j=0f660c0a-4423-5c5d-276b-f98b39c69e13&t=0b176b82-c97a-5033-1567-981690da77e3&l=2845

Could you please remove variable names where it's not used to fix it? Thank you.

Code after:

        settings.set_overview_link(L"https://aka.ms/PowerToysOverview_ColorPicker");

        return settings.serialize_to_buffer(buffer, buffer_size);
    }

    virtual void call_custom_action(const wchar_t* action) override
    {
    }

    virtual void set_config(const wchar_t* config) override
    {
        try
        {
            // Parse the input JSON string.
            PowerToysSettings::PowerToyValues values =
                PowerToysSettings::PowerToyValues::from_json_string(config, get_key());

            parse_hotkey(values);
            // If you don't need to do any custom processing of the settings, proceed
            // to persists the values calling:
            values.save_to_settings_file();
            // Otherwise call a custom function to process the settings before saving them to disk:
            // save_settings();
        }
        catch (std::exception&)
        {
            // Improper JSON.
        }
    }

    virtual void enable()
    {
        Logger::trace("ColorPicker::enable()");
        ResetEvent(send_telemetry_event);
        ResetEvent(m_hInvokeEvent);
        launch_process();
        m_enabled = true;
    };

    virtual void disable()
    {
        Logger::trace("ColorPicker::disable()");
        if (m_enabled)
        {
            ResetEvent(send_telemetry_event);
            ResetEvent(m_hInvokeEvent);
            TerminateProcess(m_hProcess, 1);
        }

        m_enabled = false;