PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.20
ووسلام – همگام سازی ووکامرس و باسلام v1.10.20
1.10.21 1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 All 54 releases
← All changes | includes/Services/Api/ApiResponseHandler.php +14 -1 1.9.21.10.20 View file →
@@ -91,13 +91,26 @@
91 91 if (isset($clientErrors[$statusCode])) {
92 92 $bodyMessage = $this->extractErrorMessageFromBody($body);
93 93 $base = $bodyMessage ?: $clientErrors[$statusCode];
94 94 $reason = RequestStatusTracker::describeHttpStatusFa($statusCode);
95 - throw NonRetryableException::permanent(esc_html($base . $reason));
95 + throw NonRetryableException::permanent(esc_html($base . $reason))
96 + ->setResponseData($this->decodeBody($body));
96 97 }
97 98
98 99 // Unknown error - treat as retryable
99 100 throw RetryableException::temporary(esc_html(RequestStatusTracker::describeHttpStatusFa($statusCode)));
101 + }
102 +
103 + private function decodeBody($body): ?array
104 + {
105 + if (is_array($body)) return $body;
106 +
107 + if (is_string($body) && $body !== '') {
108 + $decoded = json_decode($body, true);
109 + if (is_array($decoded)) return $decoded;
110 + }
111 +
112 + return null;
100 113 }
101 114
102 115 private function extractErrorMessageFromBody($body): ?string
103 116 {