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

[feat] - Introduce Fatal/Non-Fatal File Handling Errors #3521

Merged
merged 12 commits into from
Nov 16, 2024

Conversation

ahrav
Copy link
Collaborator

@ahrav ahrav commented Oct 28, 2024

Description:

This PR addresses the third point in this comment.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@ahrav ahrav requested a review from a team October 28, 2024 19:30
@ahrav ahrav marked this pull request as ready for review October 28, 2024 19:30
@ahrav ahrav requested a review from a team as a code owner October 28, 2024 19:30
Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a request for some additional comments, but this looks pretty clean! Thanks for breaking it out.

@@ -351,7 +361,7 @@ func HandleFile(
// handleChunksWithError processes data and errors received from the dataErrChan channel.
// For each DataOrErr received:
// - If it contains data, the function creates a chunk based on chunkSkel and reports it through the reporter.
// - If it contains an error, the function logs the error.
// - If it contains an error, the function returns the error immediately.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for fatal errors, right? This comment seems like a good place to explain non-fatal errors as well. I would also like in some comment somewhere a description of what types of errors are fatal versus non-fatal - maybe in the doc comments of functions that use DataOrErr?

}
}()

start := time.Now()
arReader, err := deb.LoadAr(input)
if err != nil {
ctx.Logger().Error(err, "Error loading AR file")
dataOrErrChan <- DataOrErr{
Err: fmt.Errorf("%w: loading AR error: %v", ErrProcessingFatal, err),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care that we "lose" the original err since we're wrapping the sentinel error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would still maintain the error string though correct? Do you think we should use errors.Join here instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would still maintain the error string though correct?

Yeah

Do you think we should use errors.Join here instead?

I think it would have the same effect. It's probably better to wrap the sentinel, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so. We need to be able to use errors.Is to determine if it's a fatal error.

Base automatically changed from refactor-data-or-err to main November 16, 2024 02:31
@ahrav ahrav requested a review from a team as a code owner November 16, 2024 02:31
@ahrav ahrav merged commit 03a6951 into main Nov 16, 2024
13 checks passed
@ahrav ahrav deleted the feat-introduce-archive-error branch November 16, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants