Search code examples
scalaazure-databricksazure-synapse

Synapse notebook input validation deprecation warning


I am trying to do some input validation in a Synapse notebook running in Scala mode like this:

if (! someInputParameter.startsWith("/")) {
    error("Parameter someInputParameter should start with a forward slash (/).")
}

But I receive the following error:

warning: there was one deprecation warning; re-run with -deprecation for details

I'm guessing there is a newer way of doing this which does not trigger the deprecation warning? I don't know how to run the notebook in a mode with the -deprecation switch. I imagine it would be similar in Azure Databricks but haven't test yet.


Solution

  • Just use sys.error instead, ie

    if (! someInputParameter.startsWith("/")) {
        sys.error("Parameter someInputParameter should start with a forward slash (/).")
    }