Improve Shopify sync error logging
Deploy / deploy (push) Successful in 14s

Log clear hint for 403 (IP whitelist), 401, 429, 5xx.
Commands exit with failure and print error when API returns no data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek Tellissi
2026-09-11 02:54:44 +02:00
co-authored by Claude Sonnet 4.6
parent 467d85dfec
commit 7e9c43f2bf
3 changed files with 23 additions and 1 deletions
+5
View File
@@ -16,6 +16,11 @@ class ShopifyMap extends Command
$dryRun = $this->option('dry-run');
$variants = $shopify->getAllVariants();
if (empty($variants)) {
$this->error('Keine Varianten von Shopify erhalten — API-Aufruf fehlgeschlagen (Details im Log).');
return self::FAILURE;
}
$this->info('Shopify-Varianten geladen: ' . count($variants));
$mapped = 0;
+5
View File
@@ -18,6 +18,11 @@ class ShopifySync extends Command
$dryRun = $this->option('dry-run');
$variants = $shopify->getAllVariants();
if (empty($variants)) {
$this->error('Keine Varianten von Shopify erhalten — API-Aufruf fehlgeschlagen (Details im Log).');
return self::FAILURE;
}
$added = 0;
$removed = 0;
$inSync = 0;
+13 -1
View File
@@ -31,7 +31,19 @@ class ShopifyService
$response = Http::withHeader('X-Shopify-Access-Token', $this->token)->get($url);
if ($response->failed()) {
Log::error('Shopify API error', ['status' => $response->status(), 'body' => $response->body()]);
$status = $response->status();
$hint = match (true) {
$status === 401 => 'Access Token ungültig oder fehlt',
$status === 403 => 'IP-Whitelist: VPS-IP ist in Shopify nicht freigeschalten',
$status === 429 => 'Rate Limit überschritten',
$status >= 500 => 'Shopify-seitiger Fehler',
default => 'Unbekannter Fehler',
};
Log::error("Shopify Sync fehlgeschlagen: {$hint}", [
'status' => $status,
'url' => $url,
'body' => $response->body(),
]);
break;
}