From 2855355989d96418ecffa41f2c74d668a2aabfc1 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Thu, 28 May 2020 20:39:32 +0200 Subject: [PATCH] Remove error classes for now (#5280) Closes #5266 --- R/rows.R | 20 ++++---------------- tests/testthat/test-rows.R | 10 +++++----- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/R/rows.R b/R/rows.R index 3a6a98a5b9..d1710c9f1b 100644 --- a/R/rows.R +++ b/R/rows.R @@ -91,10 +91,7 @@ rows_insert.data.frame <- function(x, y, by = NULL, ..., copy = FALSE, in_place idx <- vctrs::vec_match(y[key], x[key]) bad <- which(!is.na(idx)) if (has_length(bad)) { - abort(class = "dplyr_rows_insert_duplicate", - "Attempting to insert duplicate rows.", - location = bad - ) + abort("Attempting to insert duplicate rows.") } rows_bind(x, y) @@ -121,10 +118,7 @@ rows_update.data.frame <- function(x, y, by = NULL, ..., copy = FALSE, in_place bad <- which(is.na(idx)) if (has_length(bad)) { - abort(class = "dplyr_rows_update_missing", - "Attempting to update missing rows.", - location = bad - ) + abort("Attempting to update missing rows.") } x[idx, names(y)] <- y @@ -152,10 +146,7 @@ rows_patch.data.frame <- function(x, y, by = NULL, ..., copy = FALSE, in_place = bad <- which(is.na(idx)) if (has_length(bad)) { - abort(class = "dplyr_rows_patch_missing", - "Attempting to patch missing rows.", - location = bad - ) + abort("Attempting to patch missing rows.") } new_data <- map2(x[idx, names(y)], y, coalesce) @@ -219,10 +210,7 @@ rows_delete.data.frame <- function(x, y, by = NULL, ..., copy = FALSE, in_place bad <- which(is.na(idx)) if (has_length(bad)) { - abort(class = "dplyr_rows_delete_missing", - "Attempting to delete missing rows.", - location = bad - ) + abort("Attempting to delete missing rows.") } dplyr_row_slice(x, -idx) diff --git a/tests/testthat/test-rows.R b/tests/testthat/test-rows.R index 0cb3bedd01..34f397cb0d 100644 --- a/tests/testthat/test-rows.R +++ b/tests/testthat/test-rows.R @@ -8,7 +8,7 @@ test_that("rows_insert()", { expect_error( rows_insert(data, tibble(a = 3, b = "z")), - class = "dplyr_rows_insert_duplicate" + "insert duplicate" ) }) @@ -22,7 +22,7 @@ test_that("rows_update()", { expect_error( rows_update(data, tibble(a = 2:3, b = "z"), by = c("a", "b")), - class = "dplyr_rows_update_missing" + "update missing" ) expect_silent( @@ -43,7 +43,7 @@ test_that("rows_patch()", { expect_error( rows_patch(data, tibble(a = 2:3, b = "z"), by = c("a", "b")), - class = "dplyr_rows_patch_missing" + "patch missing" ) expect_silent( @@ -73,7 +73,7 @@ test_that("rows_delete()", { expect_error( rows_delete(data, tibble(a = 2:4)), - class = "dplyr_rows_delete_missing" + "delete missing" ) expect_identical( @@ -83,7 +83,7 @@ test_that("rows_delete()", { expect_error( rows_delete(data, tibble(a = 2:3, b = "b"), by = c("a", "b")), - class = "dplyr_rows_delete_missing" + "delete missing" ) })