Skip to content

Commit 78acbb6

Browse files
authored
Merge pull request #28 from browserstack/LOC_2717_json_parse_exception
LOC 2717 catch JSON parse exception
2 parents 44d7e98 + 7d6b6bf commit 78acbb6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,12 @@ private void RunProcess(string arguments, string processType)
137137
{
138138
if (e.Data != null)
139139
{
140-
JObject binaryOutput = JObject.Parse(e.Data);
140+
JObject binaryOutput = null;
141+
try {
142+
binaryOutput = JObject.Parse(e.Data);
143+
} catch (Exception) {
144+
throw new Exception($"Error while parsing JSON {e.Data}");
145+
}
141146
if(binaryOutput.GetValue("state") != null && !binaryOutput.GetValue("state").ToString().ToLower().Equals("connected"))
142147
{
143148
throw new Exception("Eror while executing BrowserStackLocal " + processType + " " + e.Data);

0 commit comments

Comments
 (0)