warn_or_raise
warn_or_raise(
msg: str ,
exception: type[<class ’Exception] = <class ‘Exception’>,
warning: type[<class ’Warning] = <class ‘UserWarning’>,
behavior: Literal[‘warn’, ‘raise’, ‘ignore’] = warn,
)
A helper function to issues a warning, raise an exception or do nothing.
Parameters
| Parameter | Description |
|---|---|
| msg | The message to attach to warning or exception. |
| exception | The exception class to raise. |
| warning | The type of warning to use. Must be a subclass of Warning. |
| behavior |
“warn” to issue the warning, “raise” to raise the exception, and “ignore” to do nothing. Anything else raises a ParameterError, so a retired spelling cannot quietly pick a behavior. |