I’ve defined an object that pulls in the API’s sample of random matches for the day, which is working correctly (the “platform shard” is defined earlier in the code with a view):
I then have another cell defined that’s iterating through the list of match IDs from the previous “matchIDs” object…
… that when running successfully returns a bunch data about each match to the screen every second (running it at once a second for the sake of testing).
Here’s the problem. For some reason, random match IDs from that “matchIDs.data.relationships.matches.data[i].id” array randomly return a “NetworkError”. Not entirely sure why (must be an issue with the API itself), and not exactly a big deal because I don’t need the data from every match I’m iterating through. The problem is the NetworkError breaks the loop in the cell and halts it.
So my question: Is there a way to write a for loop that checks for TypeErrors (like my NetworkError) and passes over them when appropriate, as opposed to breaking the entire loop?