From babdcc8fc986a53752057e07471f3daadb566b43 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Wed, 22 Nov 2023 10:25:22 -0700 Subject: [PATCH] Use correct classed error for "same name, different user" case (#808) * Use correct classed error for "same name, different user" case * Update NEWS, test snapshot --- NEWS.md | 2 ++ R/board_connect.R | 5 ++++- tests/testthat/_snaps/board_connect.md | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9cfdd101..2cc541fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/board_connect.R b/R/board_connect.R index b6d8c297..c1956643 100644 --- a/R/board_connect.R +++ b/R/board_connect.R @@ -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]] } diff --git a/tests/testthat/_snaps/board_connect.md b/tests/testthat/_snaps/board_connect.md index 97a3194a..10d8f47a 100644 --- a/tests/testthat/_snaps/board_connect.md +++ b/tests/testthat/_snaps/board_connect.md @@ -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