Remove redundant error handling from project provider, add a better message for deserialization exceptions
This commit is contained in:
parent
78093ae1be
commit
1d1f848611
3 changed files with 16 additions and 21 deletions
|
@ -85,7 +85,7 @@ namespace Microsoft.DotNet.Tools.Run.LaunchSettings
|
|||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
return new LaunchSettingsApplyResult(false, string.Format(LocalizableStrings.UnexpectedExceptionProcessingLaunchSettings, ex.Message));
|
||||
return new LaunchSettingsApplyResult(false, string.Format(LocalizableStrings.DeserializationExceptionMessage, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace Microsoft.DotNet.Tools.Run.LaunchSettings
|
|||
public string CommandName => CommandNameValue;
|
||||
|
||||
public LaunchSettingsApplyResult TryApplySettings(JObject document, JObject model, ref ICommand command)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = model.ToObject<ProjectLaunchSettingsModel>();
|
||||
|
||||
|
@ -33,11 +31,6 @@ namespace Microsoft.DotNet.Tools.Run.LaunchSettings
|
|||
|
||||
return new LaunchSettingsApplyResult(true, null, config.LaunchUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new LaunchSettingsApplyResult(false, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private class ProjectLaunchSettingsModel
|
||||
{
|
||||
|
|
|
@ -50,5 +50,7 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
public const string UnexpectedExceptionProcessingLaunchSettings = "An unexpected exception occurred while processing launch settings:\n{0}";
|
||||
|
||||
public const string LaunchProfilesCollectionIsNotAJsonObject = "The 'profiles' property of the launch settings document is not a JSON object.";
|
||||
|
||||
public const string DeserializationExceptionMessage = "An error was encountered when reading launchSettings.json.\n{0}";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue