Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1358: more informative error message when calling runApp inside of an app's app.R #1482

Merged
merged 1 commit into from
Dec 16, 2016

Conversation

bborgesr
Copy link
Contributor

@bborgesr bborgesr commented Nov 23, 2016

Fixes #1358: more informative error message when calling runApp inside of an app's app.R (or inside ui.R or server.R).

This used to be: stop("Key ", key, " already in use")

Now it is: stop("Please remove any calls to runApp from inside your source code. (Details: Key ", key, " already in use)").

The only way I see this may be problematic is if this error is raised in another context (that isn't calling runApp from the app's source code). But I don't think that ever happens (?)

Again, I don't think this merits a NEWS entry... Let me know if you disagree

@wch
Copy link
Collaborator

wch commented Dec 1, 2016

A couple things:

  • This message would work better: "Can't call runApp from within runApp. If your application code contains runApp(), please remove it."
  • runApp could check this at the top:
  if (.globals$running) {
    stop("HEY!")
  }
  .globals$running <- TRUE
  on.exit({
    .globals$running <- FALSE
  },add = TRUE)
  • And .globals$running <- FALSE would have to be already set.

…e of an app's app.R (or inside ui.R or server.R).
@bborgesr bborgesr force-pushed the barbara/runapp branch 4 times, most recently from 3300f1a to c350e2a Compare December 15, 2016 21:55
@wch wch merged commit 29943b7 into master Dec 16, 2016
@wch wch removed the review label Dec 16, 2016
@wch wch deleted the barbara/runapp branch December 16, 2016 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants