File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,10 @@ getStargazers repoName env =
181
181
, timeoutInMs = Nothing
182
182
, cachePath = Nothing
183
183
}
184
- |> BackendTask . allowFatal
184
+ |> BackendTask . mapError
185
+ ( \ err ->
186
+ FatalError . fromString <| " Error fetching stargazers for project " ++ repoName ++ " \n " ++ httpErrorToString err. recoverable
187
+ )
185
188
|> BackendTask . map
186
189
( \ stargazers ->
187
190
if stargazers >= 5 then
@@ -192,6 +195,29 @@ getStargazers repoName env =
192
195
)
193
196
194
197
198
+ httpErrorToString : BackendTask .Http .Error -> String
199
+ httpErrorToString error =
200
+ let
201
+ body =
202
+ case error of
203
+ BackendTask . Http . BadUrl string ->
204
+ " BadUrl " ++ string
205
+
206
+ BackendTask . Http . Timeout ->
207
+ " Timeout"
208
+
209
+ BackendTask . Http . NetworkError ->
210
+ " NetworkError"
211
+
212
+ BackendTask . Http . BadStatus metadata _ ->
213
+ " BadStatus: " ++ String . fromInt metadata. statusCode ++ " " ++ metadata. statusText
214
+
215
+ BackendTask . Http . BadBody _ string ->
216
+ " BadBody " ++ string
217
+ in
218
+ " HTTP Error: " ++ body
219
+
220
+
195
221
196
222
-- if the project doesn't have a "year" field, scrape the github API
197
223
-- to get the date of the first commit and latest commit, and use that to create a range
You can’t perform that action at this time.
0 commit comments