• Dan Winship's avatar
    libnm-core: clean up NMConnectionError · aeb3d093
    Dan Winship authored
    Rename NM_CONNECTION_ERROR_UNKNOWN to NM_CONNECTION_ERROR_FAILED,
    following GError best practices.
    
    Replace NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND ("no
    NMSettingConnection") with a more generic
    NM_CONNECTION_ERROR_MISSING_SETTING. Use that new code in a few places
    that had previously been using NM_CONNECTION_ERROR_SETTING_NOT_FOUND,
    which was supposed to mean "the setting that you asked about doesn't
    exist", not "the connection is invalid because it's missing a required
    setting".
    
    Clarify that NM_CONNECTION_ERROR_INVALID_SETTING can be used for any
    "invalid or inappropriate NMSetting", not just a "conflicting" one.
    (But fix a case in nm_connection_update_secrets() that was returning
    INVALID_SETTING when it should have been return-if-failing instead.)
    
    For both MISSING_SETTING and INVALID_SETTING, always prefix the error
    message with "setting-name: ", just like we do with the various
    NMSetting MISSING_PROPERTY and INVALID_PROPERTY errors. And make sure
    that the error message is marked for localization.
    
    Drop NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, which is pretty
    pointless; it was only used in the case where connection.type was the
    name of a valid setting type that is not a base setting type. Instead,
    just return NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY for
    connection.type in this case (which is what the code already did when
    connection.type was completely unrecognized).
    aeb3d093
test-general.c 123 KB