Skip to content

Commit

Permalink
Include value in error message about invalid value from `register_met…
Browse files Browse the repository at this point in the history
…hod()`

Closes #447
  • Loading branch information
t-kalinowski committed Oct 10, 2024
1 parent 03dece2 commit 58a11e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/generic-spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ as_S3_generic <- function(x) {
}
}

stop("`generic` is a function, but not an S3 generic function", call. = FALSE)
stop("`generic` is a function, but not an S3 generic function: ",
deparse1(x, width.cutoff = 100L), call. = FALSE)
}

S3_generic <- function(generic, name) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/generic-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
as_generic(function() { })
Condition
Error:
! `generic` is a function, but not an S3 generic function
! `generic` is a function, but not an S3 generic function: function () { }

---

Expand Down

0 comments on commit 58a11e3

Please sign in to comment.