Skip to content

Commit

Permalink
Use correct classed error for "same name, different user" case (#808)
Browse files Browse the repository at this point in the history
* Use correct classed error for "same name, different user" case

* Update NEWS, test snapshot
  • Loading branch information
juliasilge committed Nov 22, 2023
1 parent 2aa0fae commit babdcc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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

0 comments on commit babdcc8

Please sign in to comment.