Printing Error Messages on Screen

I'm seeing a difference in how error messages are printed to screen between a local version of Shiny and when accessing the same app over at a Shiny Server.

Take as an example the following toy function

myFunc <- function(x,y){
if(x < y) stop('Give a reason')
...
}

When I run this in a shiny app locally, the condition is evaluated and if TRUE, the message 'Give a reason' is printed in the webapp browser.

However, when that same code is deployed to our shiny server hosting the app, the following is printed on screen if the condition evaluated is TRUE.

"Error: An error has occurred. Check your logs or contact the app author for clarification."

Why does shiny server behave differently than shiny locally when running the same code?

More importantly, in light of the fact that it does behave differently, how can I get the stop() message I wrote in my function to print on screen in any environment?

My code has many meaningful error messages and the error message printed to screen when using the server loses all context and meaning.

I'm very new to shiny/R/programming, but I think it looks like it's something to do with sanitising error messages:

I think there's a solution on stackoverflow you might want to try:

good luck! :slight_smile: