From 3e38f0bba09ca5038535cd4a7eae4df7f3328564 Mon Sep 17 00:00:00 2001 From: Rakdos8 Date: Wed, 17 May 2023 20:10:09 +0200 Subject: [PATCH] fix: error handling in case of return code 502 (#88) --- src/Containers/EsiResponse.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Containers/EsiResponse.php b/src/Containers/EsiResponse.php index e741d54..fbcc6ac 100644 --- a/src/Containers/EsiResponse.php +++ b/src/Containers/EsiResponse.php @@ -121,6 +121,10 @@ public function __construct( $this->error_message .= ': ' . $data->error_description; } + // If the query failed to contact the ESI endpoint + if ($this->response_code === 502) + $this->error_message = 'Bad gateway'; + // Run the parent constructor parent::__construct(is_array($data) ? (array) $data : (object) $data, ArrayObject::ARRAY_AS_PROPS); }