Skip to content

Commit

Permalink
DS-3841: More helpful error message when sav file cannot be parsed (#34)
Browse files Browse the repository at this point in the history
* Update with a more helpful error message

* Add ubuntu pkgs for devtools/textshaping on travis
  • Loading branch information
JustinCCYap committed Aug 9, 2022
1 parent 3e620a8 commit 130e205
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: flipData
Type: Package
Title: Functions for extracting and describing data
Version: 1.6.4
Version: 1.6.5
Author: Displayr <opensource@displayr.com>
Maintainer: Displayr <opensource@displayr.com>
Description: Functions for extracting data from formulas and
Expand Down
3 changes: 2 additions & 1 deletion R/mergingandstackingutilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ createReadErrorHandler <- function(data.set.name)
function(e) {
if (grepl("Invalid file, or file has unsupported features", e$message)) {
stop(paste0("The data file '", data.set.name, "' could not be parsed. ",
"Check the data set for issues and try again after fixing them or removing unnecessary variables."))
"The data file may be fixed by inserting it in a Displayr document, ",
"exporting it as an SPSS file (.sav) via the Publish button, and then uploading it back to the cloud drive. "))
} else {
stop(e$message)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-mergingandstackingutilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test_that("readDataSets: better error message when data file is invalid", {
mock.parser <- function(x) stop("Invalid file, or file has unsupported features")
expect_error(readLocalDataSets("bad.sav", mock.parser),
paste0("The data file 'bad.sav' could not be parsed. ",
"Check the data set for issues and try again after fixing them or removing unnecessary variables."))
"The data file may be fixed by inserting it in a Displayr document, exporting it as an SPSS file \\(.sav\\) via the Publish button, and then uploading it back to the cloud drive."))
})

if (file.exists("Combined data set.sav"))
Expand Down

0 comments on commit 130e205

Please sign in to comment.