Skip to content

Commit

Permalink
less cryptic error message in parse_params(); closes #412
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 28, 2012
1 parent 667b0a0 commit 90dccbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ parse_params = function(params, label = TRUE) {
idx = which(names(res) == '') # which option is not named?
if (is.null(names(res))) idx = 1L # empty name, must be label
if ((n <- length(idx)) > 1L) {
stop("all options must be of the form 'tag=value' except the chunk label")
stop("invalid chunk options: ", params,
"\n(all options must be of the form 'tag=value' except the chunk label)")
} else if (!label && n > 0L) stop('all global options must be of the form tag=value')
if (n == 1L) names(res)[idx] = 'label' else if (label) {
if (!('label' %in% names(res))) res$label = unnamed_chunk()
Expand Down

0 comments on commit 90dccbc

Please sign in to comment.