Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit fb53a48

Browse files
author
Lauri Piispanen
committed
catch type conversion errors
1 parent 489f603 commit fb53a48

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

github/github.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,18 @@ Pages:
155155
log.Fatalln("Too many errors received. Quitting.")
156156
}
157157
}
158-
dataNode := rootNode["data"].(map[string]interface{})
158+
dataNode, ok := rootNode["data"].(map[string]interface{})
159+
if !ok {
160+
retryCount++
161+
if retryCount < maxRetryCount {
162+
log.Println("Error accessing data element")
163+
time.Sleep(10 * time.Second)
164+
continue Pages
165+
} else {
166+
log.Fatalln("Too many errors received. Quitting.")
167+
}
168+
}
169+
159170
searchNode := dataNode["search"].(map[string]interface{})
160171
totalUsersCount = int(searchNode["userCount"].(float64))
161172
edgeNodes := searchNode["edges"].([]interface{})

0 commit comments

Comments
 (0)