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

Report failure when write.xlsx fails. #208

Merged
merged 19 commits into from
Aug 2, 2021
Merged

Report failure when write.xlsx fails. #208

merged 19 commits into from
Aug 2, 2021

Conversation

jeff-m-sullivan
Copy link
Contributor

Fixes #190 .

The pre-commit hooks were set up to require styler, so I ran styler on the files i changed, but committed the style pieces separately in case you want to strip them out.

Added a testthat test to show the bug and re-ran all tests to confirm that the fix doesn't break anything else.

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2021

Codecov Report

Merging #208 (ec229fe) into master (63b21b7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #208   +/-   ##
=======================================
  Coverage   65.60%   65.60%           
=======================================
  Files          34       34           
  Lines        8919     8920    +1     
=======================================
+ Hits         5851     5852    +1     
  Misses       3068     3068           
Impacted Files Coverage Δ
R/wrappers.R 51.10% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e77e5ba...ec229fe. Read the comment docs.


## delete temporary dir
unlink(dirname(xlsx_file), force = TRUE, recursive = TRUE)
if(returnValue == FALSE){
if (returnValue == FALSE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ycphs
Do you know if there any reason why we wouldn't want or be able to simply return the result of the file.copy()? Does using invisible(1) satisfy anything?

Copy link
Owner

Choose a reason for hiding this comment

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

Initially there was no return value and the feature request to have an optional made it necessary to have a default with no return value.

Copy link
Contributor

Choose a reason for hiding this comment

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

The default value returned was invisible(1) which I don't see as useful as having the return value be the result of file.copy() instead -- especially since if file.copy() fails saveWorkbook() essentially fails. So I guess I'm asking: should invisible(1) ever be returned or should the result of just be file.copy() (invisibly) returned?

Copy link
Owner

Choose a reason for hiding this comment

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

yes that would make more sense and it helps to actually and leads to the initial error.

@ycphs ycphs merged commit 4b52d24 into ycphs:master Aug 2, 2021
@jeff-m-sullivan jeff-m-sullivan deleted the error-failed-write branch August 2, 2021 19:01
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.

write.xlsx does not error if it doesn't have write permissions
6 participants