HomeDevCentral

[Gate] [ActionsReport] Publish error and return 503 when a task fails
aecf09db97cfUnpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

[Gate] [ActionsReport] Publish error and return 503 when a task fails

This change adds to the Action object an 'error' property (class ActionErrror)
to provide basic information about failure.

When the task fails, a task can now intercept exception and publish it with
$actionToReport->attachExcpeion($ex). Type and message should be checked
and asserted not to expose sensible information. A custom exception would
probably more safe in the last case.

The response code will be 503 instead of 200. If ActionsReport feature is
disabled, we don't inform the client of how we handle the payload, and so
a 200 is still returned.

Here a sample of reply when the message broker is down:

{
  "actions": [
    {
      "method": "publish",
      "target": "github_events",
      "routingKey": "nasqueron.orgz.ping",
      "action": "Nasqueron\Notifications\Actions\AMQPAction",
      "error": {
        "type": "PhpAmqpLib\Exception\AMQPRuntimeException",
        "message": "Error Connecting to server (101): Network is unreachable"
      }
    }
  ],
  "created": 1449468356,
  "gate": "GitHub",
  "door": "Nasqueron"
}

Details

Provenance
derecksonAuthored on
Parents
rNOTIF23ca4c0ee5e9: Prepare AMQPEventListener for multiple tasks for an event
Branches
Unknown
Tags
Unknown