Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active June 23, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadley/5a56f0519ad57e13214ab2a72197ee87 to your computer and use it in GitHub Desktop.
Save hadley/5a56f0519ad57e13214ab2a72197ee87 to your computer and use it in GitHub Desktop.
# need + validate -----------------------------------------------------------
validate(
need(
mzfinder::check_mzr_object(ms_object$mzr_connection),
"Wasn't able to connect to MS file"
)
)
validate(
need(!is.null(input$ppm_input), "ppm_input must not be null"),
need(input$ppm_input > 0L, "ppm_input must be > 0")
)
# if + validate -----------------------------------------------------------
if (!mzfinder::check_mzr_object(ms_object$mzr_connection)) {
validate("Wasn't able to connect to MS file")
}
if (is.null(input$ppm_input)) {
validate("ppm_input must not be null")
} else if (input$ppm_input <= 0L) {
validate("ppm_input must be > 0")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment