warn_or_raise

function of dascore.utils.misc source

warn_or_raise(
    msg: str ,
    exception: type[<class ’Exception] = <class ‘Exception’>,
    warning: type[<class ’Warning] = <class ‘UserWarning’>,
    behavior: Literal[‘warn’, ‘raise’, None] = 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 If None, do nothing. If