For a package-free alternative, throw(DomainError(...))
also seems to be recommended in this other thread.
Example:
dB(x) = (x > 0) ? 20*log10(x) : throw(DomainError(x, "argument <= 0"))
dB(0.5) # -6.0
dB(-0.5) # ERROR: DomainError with -0.5: argument <= 0