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

Let caller hander error cases #101

Merged
merged 7 commits into from
Apr 19, 2023
Merged

Conversation

michalpristas
Copy link
Contributor

Please consider this.
This PR introduces onErr option in a form of func(error)error which lets caller to handler error cases .
It enables caller to log error by error and gives a possibility to continue with copying in case error is not that severe by returning nil (swallowing an error).

@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #101 (b348b50) into main (dfe4363) will increase coverage by 1.03%.
The diff coverage is 100.00%.

❗ Current head b348b50 differs from pull request most recent head 2abaf6c. Consider uploading reports for the commit 2abaf6c to get more accurate results

@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
+ Coverage   78.33%   79.36%   +1.03%     
==========================================
  Files           9        9              
  Lines         180      189       +9     
==========================================
+ Hits          141      150       +9     
  Misses         19       19              
  Partials       20       20              
Impacted Files Coverage Δ
options.go 83.33% <ø> (ø)
copy.go 80.32% <100.00%> (+1.56%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@otiai10
Copy link
Owner

otiai10 commented Apr 7, 2023

in case error is not that severe

Can you give me some example of this?

@michalpristas
Copy link
Contributor Author

what i'm facing is a case when (on windows) directory copy fails because another process is reading a single file.
what i'd like to do here is to have a hook so I can decide on severity, and skip file if it's not critical for me

@otiai10
Copy link
Owner

otiai10 commented Apr 11, 2023

@otiai10 will check in 24 hours

options.go Outdated Show resolved Hide resolved
test/data/case17/README.md Outdated Show resolved Hide resolved
copy.go Outdated Show resolved Hide resolved
copy.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
michalpristas and others added 2 commits April 18, 2023 09:00
Co-authored-by: Hiromu OCHIAI <otiai10@gmail.com>
Co-authored-by: Hiromu OCHIAI <otiai10@gmail.com>
@otiai10 otiai10 merged commit 4359ba7 into otiai10:main Apr 19, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants