<@ULVA73B9P> I want to raise an exception and pass...
# ask-marvin
k
@Marvin I want to raise an exception and pass a message
m
In Prefect, you can raise exceptions with a message by using the
PrefectException
class or any of its subclasses. Here's a basic example of how you might raise an exception with a message:
Copy code
python
from prefect.exceptions import PrefectException

def my_function():
    raise PrefectException("This is a custom exception message")

my_function()
Relevant links: - Prefect exceptions source code This code snippet raises a
PrefectException
with a custom message. You can replace
PrefectException
with any specific subclass like
SerializationError
,
ConfigurationError
, etc., depending on the context of your error.