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
6 changes: 3 additions & 3 deletions R/conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ with_incompatible_s3_list_bullets <- function(message, x) {
i = "If this object comes from a package, please report this error to the package author.",
i = cli::format_inline(paste(
"Read our FAQ about",
"{.topic [creating vector types](howto_faq_fix_scalar_type_error)}",
"{.topic [creating vector types](vctrs::howto_faq_fix_scalar_type_error)}",
"to learn more."
))
)
Expand Down Expand Up @@ -763,7 +763,7 @@ with_incompatible_data_frame_bullets <- function(message, x) {
i = "If this object comes from a package, please report this error to the package author.",
i = cli::format_inline(paste(
"Read our FAQ about",
"{.topic [creating vector types](howto_faq_fix_scalar_type_error)}",
"{.topic [creating vector types](vctrs::howto_faq_fix_scalar_type_error)}",
"to learn more."
))
)
Expand All @@ -773,7 +773,7 @@ with_scalar_faq_bullet <- function(message) {
c(
message,
i = cli::format_inline(paste(
"Read our FAQ about {.topic [scalar types](faq_error_scalar_type)}",
"Read our FAQ about {.topic [scalar types](vctrs::faq_error_scalar_type)}",
"to learn more."
))
)
Expand Down
4 changes: 2 additions & 2 deletions man/faq-error-scalar-type.Rd

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

6 changes: 3 additions & 3 deletions man/howto-faq-fix-scalar-type-error.Rd

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

44 changes: 22 additions & 22 deletions tests/testthat/_snaps/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Condition
Error:
! `quote(foo)` must be a vector, not a symbol.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -16,7 +16,7 @@
! `foobar()` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# obj_check_vector() error respects `arg` and `call`

Expand All @@ -27,7 +27,7 @@
! `foo` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# obj_check_vector() error contains FAQ links and correct bullets

Expand All @@ -36,7 +36,7 @@
Condition
Error:
! `x` must be a vector, not an expression vector.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -47,7 +47,7 @@
! `x` must be a vector, not a <my_list> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <my_list>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

---

Expand All @@ -58,7 +58,7 @@
! `x` must be a vector, not a <data.frame> object.
x Detected incompatible data frame structure. A data frame is normally treated as a vector, but an incompatible class ordering was detected. To be compatible, the subclass <my_df> must come before <data.frame>, not after. Class: <data.frame/my_df>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# assertion failures are explained

Expand Down Expand Up @@ -273,7 +273,7 @@
Condition
Error:
! `quote(foo)` must be a vector, not a symbol.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -284,7 +284,7 @@
! `foobar()` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# vec_check_size() error respects `arg` and `call`

Expand All @@ -303,7 +303,7 @@
! `foo` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# vec_check_size() validates `size`

Expand Down Expand Up @@ -352,7 +352,7 @@
Condition
Error:
! `quote(foo)` must be a vector, not a symbol.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -363,7 +363,7 @@
! `foobar()` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# vec_check_recyclable() error respects `arg` and `call`

Expand All @@ -382,7 +382,7 @@
! `foo` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# vec_check_recyclable() validates `size`

Expand Down Expand Up @@ -450,21 +450,21 @@
<error/vctrs_error_scalar_type>
Error in `my_function()`:
! `my_arg[[2]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
Code
(expect_error(my_function(list(1, name = env()))))
Output
<error/vctrs_error_scalar_type>
Error in `my_function()`:
! `my_arg$name` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
Code
(expect_error(my_function(list(1, foo = env()))))
Output
<error/vctrs_error_scalar_type>
Error in `my_function()`:
! `my_arg$foo` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# list_check_all_size() works

Expand Down Expand Up @@ -520,15 +520,15 @@
<error/vctrs_error_scalar_type>
Error in `list_all_size()`:
! `x[[1]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
Code
my_function <- (function(my_arg, size) list_check_all_size(my_arg, size))
(expect_error(my_function(x, 2)))
Output
<error/vctrs_error_scalar_type>
Error in `my_function()`:
! `my_arg[[1]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# list_all_recyclable() and list_check_all_recyclable() error on scalars

Expand All @@ -538,7 +538,7 @@
<error/vctrs_error_scalar_type>
Error in `list_all_recyclable()`:
! `x[[1]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
Code
my_function <- (function(my_arg, size) {
list_check_all_recyclable(my_arg, size)
Expand All @@ -548,7 +548,7 @@
<error/vctrs_error_scalar_type>
Error in `my_function()`:
! `my_arg[[1]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# list_all_size() and list_check_all_size() throw error using internal call on non-list input

Expand Down Expand Up @@ -626,7 +626,7 @@
Condition
Error:
! `x[[2]]` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -635,7 +635,7 @@
Condition
Error:
! `x[[2]]` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -644,7 +644,7 @@
Condition
Error:
! `x[[3]]` must be a vector, not an environment.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# list_check_all_recyclable() works with `allow_null`

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
! `..1` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.
Code
(expect_error(vec_cbind(foobar(list()), .error_call = call("foo"))))
Output
Expand All @@ -128,7 +128,7 @@
! `..1` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.
Code
(expect_error(vec_cbind(a = 1:2, b = int())))
Output
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/case-when.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
Condition
Error in `vec_case_when()`:
! `values[[1]]` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -289,7 +289,7 @@
Condition
Error in `vec_case_when()`:
! `values$x` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -298,7 +298,7 @@
Condition
Error in `vec_case_when()`:
! `foo[[1]]` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -307,7 +307,7 @@
Condition
Error in `vec_case_when()`:
! `foo$x` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -316,7 +316,7 @@
Condition
Error in `vec_case_when()`:
! `..1` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

---

Expand All @@ -325,7 +325,7 @@
Condition
Error in `vec_case_when()`:
! `x` must be a vector, not `NULL`.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# `unmatched` errors are correct

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/complete.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
! `x` must be a vector, not a <lm> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <lm>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
! `x` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.
Code
(expect_error(stop_scalar_type(foobar(list(1)), arg = "foo"), class = "vctrs_error_scalar_type")
)
Expand All @@ -61,7 +61,7 @@
! `foo` must be a vector, not a <vctrs_foobar> object.
x Detected incompatible scalar S3 list. To be treated as a vector, the object must explicitly inherit from <list> or should implement a `vec_proxy()` method. Class: <vctrs_foobar>.
i If this object comes from a package, please report this error to the package author.
i Read our FAQ about creating vector types (`?howto_faq_fix_scalar_type_error`) to learn more.
i Read our FAQ about creating vector types (`?vctrs::howto_faq_fix_scalar_type_error`) to learn more.

# empty names errors are informative

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Condition <vctrs_error_scalar_type>
Error in `vec_equal()`:
! `x` must be a vector, not an expression vector.
i Read our FAQ about scalar types (`?faq_error_scalar_type`) to learn more.
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.

# `na_equal` is validated

Expand Down
Loading