Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Detect HTTP unexpected EOF errors #27

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ func poll(organization org, collector func(org) error) error {
log.Errorf("Collection failed for organization '%s' due timeout", organization.Name)
return nil
}
if httpErr.Err == io.ErrUnexpectedEOF {
log.Errorf("Collection failed for organization '%s' due to unexpected EOF", organization.Name)
return nil
}
}
if err == io.ErrUnexpectedEOF {
log.Errorf("Collection failed for organization '%s' due to unexpected EOF", organization.Name)
Expand Down
9 changes: 9 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ func TestPoll(t *testing.T) {
},
output: nil,
},
{
name: "http unexpected EOF",
collectorErr: &url.Error{
Op: "POST",
URL: "/url",
Err: io.ErrUnexpectedEOF,
},
output: nil,
},
}
for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
Expand Down