Skip to content

Commit

Permalink
give users the key to unlock opts_current in the error message (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Sep 12, 2023
1 parent 8496da0 commit 768db6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ new_defaults = function(value = list()) {
set2 = function(values) {
old = get(names(values), drop = FALSE)
if (length(values)) {
if (locked) stop('The object is read-only and cannot be modified.')
if (locked) stop(
'The object is read-only and cannot be modified. If you have to modify it ',
'for a legitimate reason, call the method $lock(FALSE) on the object before $set().'
)
defaults <<- merge(values)
}
invisible(old)
Expand Down

0 comments on commit 768db6f

Please sign in to comment.