Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zhili1208 committed Feb 25, 2016
1 parent 53ad894 commit f83234a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/NuGet.Clients/Options/PackageSourcesOptionsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,12 @@ internal bool ApplyChangedSettings()
_packageSourceProvider.SavePackageSources(packageSources);
}
}
catch (InvalidOperationException)
catch (Configuration.NuGetConfigurationException e)
{
MessageHelper.ShowErrorMessage(Resources.ShowError_ConfigInvalidOperation, Resources.ErrorDialogBoxTitle);
MessageHelper.ShowErrorMessage(e.Message, Resources.ErrorDialogBoxTitle);
return false;
}
catch (UnauthorizedAccessException)
{
MessageHelper.ShowErrorMessage(Resources.ShowError_ConfigUnauthorizedAccess, Resources.ErrorDialogBoxTitle);
}

// find the enabled package source
return true;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/NuGet.Core/NuGet.Configuration/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,16 @@
<value>Parameter 'fileName' to Settings must be just a fileName and not a path</value>
</data>
<data name="ShowError_ConfigInvalidOperation" xml:space="preserve">
<value>NuGet.Config is malformed, Please check NuGet.Config at '{0}'.</value>
<value>NuGet.Config is malformed, Please check NuGet.Config at '{0}', exception message is '{1}'.</value>
</data>
<data name="ShowError_ConfigInvalidXml" xml:space="preserve">
<value>NuGet.Config is invalid XML, Please check NuGet.Config at '{0}', exception message is '{1}'.</value>
</data>
<data name="ShowError_ConfigUnauthorizedAccess" xml:space="preserve">
<value>Can not access NuGet.Config, Please check NuGet.Config at '{0}'.</value>
<value>Can not access NuGet.Config, Please check NuGet.Config at '{0}', exception message is '{1}'.</value>
</data>
<data name="Unknown_Config_Exception" xml:space="preserve">
<value>Got exception From NuGet.Config, Please check NuGet.Config at '{0}', exception message is '{1}'.</value>
</data>
<data name="UnsupportedHashAlgorithm" xml:space="preserve">
<value>Hash algorithm '{0}' is unsupported. Supported algorithms include: SHA512 and SHA256.</value>
Expand Down
16 changes: 14 additions & 2 deletions src/NuGet.Core/NuGet.Configuration/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,25 @@ private void ExecuteSynchronizedCore(Action ioOperation)
catch(InvalidOperationException e)
{
throw new NuGetConfigurationException(
string.Format(Resources.ShowError_ConfigInvalidOperation, fileName), e);
string.Format(Resources.ShowError_ConfigInvalidOperation, fileName, e.Message), e);
}

catch (UnauthorizedAccessException e)
{
throw new NuGetConfigurationException(
string.Format(Resources.ShowError_ConfigUnauthorizedAccess, fileName), e);
string.Format(Resources.ShowError_ConfigUnauthorizedAccess, fileName, e.Message), e);
}

catch (XmlException e)
{
throw new NuGetConfigurationException(
string.Format(Resources.ShowError_ConfigInvalidXml, fileName, e.Message), e);
}

catch (Exception e)
{
throw new NuGetConfigurationException(
string.Format(Resources.ShowError_ConfigInvalidXml, fileName, e.Message), e);
}

finally
Expand Down

0 comments on commit f83234a

Please sign in to comment.