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

Use correct classed error for "same name, different user" case #808

Merged
merged 5 commits into from
Nov 22, 2023
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* Added example Python code to pin previews for Posit Connect (#806).

* Fixed a bug in how pins with the same name but different owners on Posit Connect were identified (#808).

# pins 1.3.0

## Breaking changes
Expand Down
5 changes: 4 additions & 1 deletion R/board_connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ rsc_content_find <- function(board, name, version = NULL, warn = TRUE) {
owner_guids <- map_chr(json, ~ .x$owner_guid)
owner_names <- map_chr(owner_guids, rsc_user_name, board = board)
if (!name$owner %in% owner_names) {
abort(paste0("Can't find pin named '", name$name, "' with owner '", name$owner, "'"))
cli_abort(
"Can't find pin with name {.val {name$name}} and owner {.val {name$owner}}",
class = "pins_pin_missing"
)
}
selected <- json[[name$owner %in% owner_names]]
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/board_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
rsc_content_find(board, "marjory/test-partial")
Condition
Error in `rsc_content_find()`:
! Can't find pin named 'test-partial' with owner 'marjory'
! Can't find pin with name "test-partial" and owner "marjory"

# can create and delete content

Expand Down
Loading