Catch JSONException but continue loop

Can anyone point out how to bypass JSONExceptions and continue on in a For Loop?

I have tried the below but it stops at the error every time.

For i As integer = Min.Text.ToInteger to Max.Text.ToInteger
Try
  dim db as database = Session.db
  dim url As String = "https://api.website.com/api/v1/template/?ids="+ i.ToString + "&categoryId=1"
  
    dim socket1 As New URLConnection
    socket1.RequestHeader("x-user-jwt") = app.JWT
    Var origin As String = socket1.SendSync("GET", url, 20)
    
    Var json As New JSONItem(origin)
    Var jsonData As JSONItem = json.Value("data")
    Var item As JSONItem = jsonData.ValueAt(0)
    
Listbox1.AddRow(item.Value("id"),item.Value("uuid"),item.Child("player").Value("handle"),item.Child("treatment").Value("season"),item.Child("treatment").Value("tier"),item.Child("treatment").Value("name"),item.Child("images").Value("size225"))
  Catch e As JSONException
    Continue For I
  End Try
Next I

It looks like I was doing it right. I had a key exception error that I wasn’t accounting for.

1 Like