Skip to content

WIP: Improvements to error handling in queueing library

Robert Sinton requested to merge feature/queue_library_improvements into master

Background

In various projects, I've occasionally run into problems when queue jobs failed but didn't return a JSON-encoded response, or Exceptions were thrown outside of the Guzzle call context.

What I did

  • Explicitly catch and handle Guzzle exceptions that indicate a genuine 4xx or 5xx response.
  • Extract the response body as a string if turns out not to be a JSON object.
  • Handle other Exceptions separately, to give the best chance of recording a meaningful error message in the log.

Implications

None

Setup

None

How to test

  • Code review
  • Pick a queue jobs and get it to output an error with a straight string message; observe that this is now reported better in the queue log.
  • Try and break it!
Edited by Robert Sinton

Merge request reports