Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export(IsDisplayrCloudDriveAvailable)
export(QDeleteFiles)
export(QFileExists)
export(QFileOpen)
export(QGetSharedUrl)
export(QLoadData)
export(QSaveData)
export(RunSQL)
Expand Down
2 changes: 1 addition & 1 deletion R/DataMart.R
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ QGetSharedUrl <- function(filename)
encode = "raw"))
has.errored <- inherits(res, "try-error")

if (res$status_code == 404)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in some cases we have 404s in some cases it's 400s + content. Seems to be a datamart thingy.

if (res$status_code == 404 || httr::content(res, as = "text") == "File not found")
{
stop("QGetSharedUrl has encountered an unknown error. ",
"404: No such file exists. ",
Expand Down
22 changes: 22 additions & 0 deletions man/QGetSharedUrl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions tests/testthat/test-datamart.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,6 @@ test_that("QGetSharedUrl: bad cases", {
QGetSharedUrl("file_that_does_not_exist.rds"),
"404: No such file exists"
)

# 404 error with mocked POST
Copy link
Collaborator Author

@Braedon-Wooding-Displayr Braedon-Wooding-Displayr Feb 3, 2026

Choose a reason for hiding this comment

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

Makes no sense to mock this since we can just execute above which will accomplish same result (against a real server).

mocked.post <- function(...) {
list(status_code = 404)
}
with_mocked_bindings(
POST = mocked.post,
QGetSharedUrl("any_file.rds"),
.package = "httr"
) |>
expect_error(
paste0(
"QGetSharedUrl has encountered an unknown error. ",
"404: No such file exists. ",
"The likely cause was an incorrect path preceding the filename, ",
"or insufficient access to the file path."
),
fixed = TRUE
)
})

test_that("Delete Data",
Expand Down
Loading