provisioning-exception-slack-notify-reraise

Status: IN

Production provisioning functions wrap the entire operation in try/except, send a Slack failure notification on error, then re-raise — ensuring the caller still sees the failure while operators get immediate alerts.

Source: repo:ftl2-servercraft/ftl2_servercraft/scripts/neoforge.py

Example

async def provision(ftl, config, log):
    try:
        await _step1_infrastructure(ftl, config, log)
        await _step2_application(ftl, config, log)
    except Exception as exc:
        try:
            await ftl.local.community.general.slack(
                channel=config.slack_channel,
                msg=f"{config.name}: Provisioning failed: {exc}",
            )
        except Exception:
            pass
        raise

JSON