jon doe
jon doe

Reputation: 87

Change the default error message in Shiny

Currently I am using this to deal with users inputting any wrong data into my app:

options(shiny.sanitize.errors = TRUE)

It returns this error message:

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

Is there a way to change the content of this message to something else like, say "Invalid username. Please try again", i don't want to use try-catch and want to just change this default error message.

Upvotes: 3

Views: 1033

Answers (1)

thmschk
thmschk

Reputation: 644

You can change the default text with css:

tags$head(tags$style(".shiny-output-error{visibility: hidden}")),

tags$head(tags$style(".shiny-output-error:after{content: 'Invalid username. Please try again';
visibility: visible}")),

But as greg L said, this message will appear for any error - so you should choose a text that holds globally.

Upvotes: 4

Related Questions