What would be the preferred way to fail the flow w...
# ask-community
j
What would be the preferred way to fail the flow without printing the stack trace? E.g.
Copy code
from prefect import flow, get_run_logger
from prefect.states import Failed

@flow
def my_flow():
    logger = get_run_logger()
    logger.error(
        "Incremental replication was requested, but "
        "the metadata table does not exist"
    )
    return Failed(msg="Missing metadata record for incremental replication")
Output looks like so
Copy code
...
12:41:27.267 | ERROR   | Flow run 'lemon-firefly' - Incremental replication was requested, but the metadata table does not exist
12:41:27.282 | ERROR   | Flow run 'lemon-firefly' - Finished in state Failed()
Traceback (most recent call last):
... <lots of text!>
prefect.exceptions.FailedRun: Run failed.
I would like to remove the stack trace as it is unnecessary and adds confusion 😞
f
From what I saw in source code the display is hardcoded
j
That's unfortunate. I'll see if I have some time to open a PR little later on. Thank you for checking!