To catch URI Format Exception in PT Run (#6580)

* add a catch block for uri format exceptions

* Added link to watson crash
This commit is contained in:
Alekhya
2020-09-11 13:04:25 -07:00
committed by GitHub
parent db9677bb4a
commit 0478d99aac

View File

@@ -376,7 +376,18 @@ namespace Microsoft.Plugin.Program.Programs
if (line.StartsWith(urlPrefix, StringComparison.OrdinalIgnoreCase))
{
urlPath = line.Substring(urlPrefix.Length);
Uri uri = new Uri(urlPath);
try
{
Uri uri = new Uri(urlPath);
}
catch (UriFormatException e)
{
// To catch the exception if the uri cannot be parsed.
// Link to watson crash: https://watsonportal.microsoft.com/Failure?FailureSearchText=5f871ea7-e886-911f-1b31-131f63f6655b
ProgramLogger.LogException($"|Win32Program|InternetShortcutProgram|{urlPath}|url could not be parsed", e);
return new Win32Program() { Valid = false, Enabled = false };
}
// To filter out only those steam shortcuts which have 'run' or 'rungameid' as the hostname
if (internetShortcutURLPrefixes.Match(urlPath).Success)