You can try this:
: ${depth?"Error Message"} ## when your depth variable is not even declared or is unset.
NOTE: Here it's just ? after depth.
or
: ${depth:?"Error Message"} ## when your depth variable is declared but is null like: "depth=".
NOTE: Here it's :? after depth.
Here if the variable depth is found null it will print the error message and then exit.