Is there a way to show the error message from a fa...
# ask-community
i
Is there a way to show the error message from a failure on dagster-msteams? The way it works today I only get the information about the job that failed, the step, but not the error itself.
j
you can write a function that gets the information you want from the job failure and that will be added to the message sent to msteams. you’ll want the
message_fn
parameter https://docs.dagster.io/_apidocs/libraries/dagster-msteams#dagster_msteams.make_teams_on_run_failure_sensor
😕 1
i
Yeah, I know, but that's the problem, I really don't understand where is the information I want. This right here, was pure try and error. And yet, I couldn't find where I got the Exceptions messages. Its something like "ERROR: Message generated by the exception"
Copy code
def _ms_teams_webhook_message(context: RunFailureSensorContext) -> str:
    return "\n".join(
        [
            f"""JOB: {context.dagster_run.job_name} failed!\n
            RUN ID: {context.dagster_run.run_id}\n
            ERROR: {context.failure_event.message}\n
            RUN CONFIG: {context.dagster_run.run_config}\n"""
        ]
    )
Also, the format of the card generated doesn't accept changes, I tried to do something like JOB: RUN ID: ERROR: RUN CONFIG: But I'm getting this totally not formatted JOB: job_abc_yzx! RUN ID: df3bf4a5-bf29-472f-aaf9-89c483f792de ERROR: Execution of run for "job_log_biometria" failed. Steps failed: ['copy_redshift_backfill_options']. RUN CONFIG: {'ops': {'op_log_biometria': {'config': {'date': '2023-05-19 070000'}}}} View in Dagit
j
ah i see. let me ask around for where to get the error information - i myself don’t know where to find it right now. As for the formatting, i think that might be the MS Teams API not respecting new lines
🌈 1
i
thanks, did you have any news?
j
if you use the
context.get_step_failure_events()
function do you get any additional information?
i
I'll try it, thanks