Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: more error event reporting #104

Merged
merged 1 commit into from
Oct 15, 2022
Merged
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
10 changes: 8 additions & 2 deletions filclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,10 @@ func (fc *FilClient) RetrieveContentFromPeerWithProgressCallback(
// Confirm that we actually ended up with the root block we wanted, failure
// here indicates a data transfer error that was not properly reported
if has, err := fc.blockstore.Has(ctx, rootCid); err != nil {
return nil, fmt.Errorf("could not get query blockstore: %w", err)
err = fmt.Errorf("could not get query blockstore: %w", err)
fc.retrievalEventPublisher.Publish(
rep.NewRetrievalEventFailure(rep.RetrievalPhase, rootCid, peerID, address.Undef, err.Error()))
return nil, err
} else if !has {
msg := "data transfer failed: unconfirmed block transfer"
fc.retrievalEventPublisher.Publish(
Expand All @@ -1792,7 +1795,10 @@ func (fc *FilClient) RetrieveContentFromPeerWithProgressCallback(

state, err := fc.dataTransfer.ChannelState(ctx, chanid)
if err != nil {
return nil, fmt.Errorf("could not get channel state: %w", err)
err = fmt.Errorf("could not get channel state: %w", err)
fc.retrievalEventPublisher.Publish(
rep.NewRetrievalEventFailure(rep.RetrievalPhase, rootCid, peerID, address.Undef, err.Error()))
return nil, err
}

duration := time.Since(startTime)
Expand Down