LLM Skills
~/catalogue/tests et qualité//error-handling
Tests et qualitésource GitHub

Tester la validité du token

/error-handling

Les API BigCommerce renvoient des codes de statut HTTP standard avec des réponses d'erreur JSON. Comprendre les erreurs courantes et mettre en place une gestion adaptée est essentiel pour des intégrations fiables.

qdhenryqdhenry
1.3k
1 mars 2026
// contenu du skill

<overview>

BigCommerce APIs return standard HTTP status codes with JSON error responses. Understanding common errors and implementing proper handling is crucial for reliable integrations.

</overview>

<status_codes>

<success_codes>

CodeMeaning
200OK - Request successful
201Created - Resource created
204No Content - Successful deletion

</success_codes>

<client_errors>

CodeMeaningAction
400Bad RequestCheck request format, headers
401UnauthorizedCheck credentials, token validity
403ForbiddenCheck OAuth scopes, permissions
404Not FoundVerify resource exists, check ID
405Method Not AllowedUse correct HTTP method
409ConflictResource state conflict, retry
413Payload Too LargeReduce request size
415Unsupported Media TypeUse application/json
422Unprocessable EntityCheck data validity, required fields
429Too Many RequestsRate limited, implement backoff

</client_errors>

<server_errors>

CodeMeaningAction
500Internal Server ErrorRetry with backoff
502Bad GatewayRetry with backoff
503Service UnavailableRetry with backoff
504Gateway TimeoutRetry with backoff

</server_errors>

</status_codes>

<errorresponseformat>

<standard_format>

json
{
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "https://developer.bigcommerce.com/docs/start/about/status-codes",
  "errors": {
    "name": "Product name is required",
    "price": "Price must be a positive number"
  }
}

</standard_format>

<graphql_errors>

GraphQL always returns HTTP 200 with errors in body:

json
{
  "data": null,
  "errors": [
    {
      "message": "Product not found",
      "locations": [{"line": 2, "column": 3}],
      "path": ["site", "product"]
    }
  ]
}

Important: All GraphQL errors return HTTP 401 status - check response body for details.

</graphql_errors>

</errorresponseformat>

<common_errors>

<error name="401-unauthorized">

Causes:

  • Expired access token
  • Invalid access token
  • Missing X-Auth-Token header
  • Wrong store hash

Diagnosis:

bash
# Test token validity
curl -X GET \
  'https://api.bigcommerce.com/stores/{store_hash}/v3/catalog/summary' \
  -H 'X-Auth-Token: {access_token}' \
  -H 'Accept: application/json'

Solutions:

  • Verify token is correct (no extra whitespace)
  • Check token hasn't expired
  • Regenerate credentials if needed
  • Verify store hash matches token

</error>

<error name="403-forbidden">

Causes:

  • OAuth scope insufficient
  • Resource belongs to different app
  • Store plan doesn't include feature

Diagnosis:

Check required scopes for endpoint in documentation.

Solutions:

  • Add required OAuth scopes to API account
  • For apps: Re-authorize with expanded scopes
  • Contact merchant about plan features

</error>

<error name="404-not-found">

Causes:

  • Resource doesn't exist
  • Resource was deleted
  • Wrong resource ID
  • Typo in endpoint URL

Diagnosis:

bash
# Verify resource exists
GET /v3/catalog/products/{product_id}

Solutions:

  • Verify ID is correct
  • Check if resource was deleted
  • Handle gracefully in code

</error>

<error name="422-unprocessable-entity">

Causes:

  • Missing required fields
  • Invalid field values
  • Data type mismatch
  • Business rule violation

Example:

json
{
  "status": 422,
  "errors": {
    "weight": "Weight is required for physical products",
    "price": "Price must be greater than 0"
  }
}

Diagnosis:

Review error messages - they specify which fields have problems.

Solutions:

  • Add missing required fields
  • Validate data before sending
  • Check data types match schema
  • Review API documentation for constraints

</error>

<error name="429-rate-limited">

Causes:

  • Exceeded 20,000 requests/hour
  • B2B: Exceeded 150 requests/minute
  • Payments: Exceeded 50 requests/4 seconds

Headers to check:

X-Rate-Limit-Requests-Left: 0
X-Rate-Limit-Time-Reset-Ms: 1800000
X-Retry-After: 300

Solutions:

  • Implement exponential backoff
  • Respect Retry-After header
  • Optimize request patterns
  • Use batching and caching

</error>

</common_errors>

<troubleshooting_auth>

<checklist>

  1. Token format correct?
  • No extra whitespace
  • Complete token (not truncated)
  • Using X-Auth-Token header (not Authorization)
  1. Store hash matches token?
  • Token is store-specific
  • Check URL: /stores/{correct_hash}/
  1. Token still valid?
  • App tokens are permanent but can be revoked
  • Storefront tokens expire
  1. Required scopes present?
  • Check API account scopes in control panel
  • Match required scopes for endpoint
  1. Clock sync?
  • Server time must be accurate
  • Use NTP for synchronization

</checklist>

<debugging_requests>

bash
# Verbose curl to see all headers
curl -v -X GET \
  'https://api.bigcommerce.
// source originale publique
qdhenry/Claude-Command-Suite
/.claude/skills/bigcommerce-api/references/error-handling.md
Licence : Licence non indiquée. Consultez le dépôt avant toute réutilisation.
Projet indépendant, non affilié à Anthropic. Ce skill reste la propriété de son auteur original.
// installer ce skill
Collez cette commande dans votre terminal à la racine de votre projet :
mkdir -p .claude/commands && curl -o ".claude/commands/error-handling.md" "https://raw.githubusercontent.com/qdhenry/Claude-Command-Suite/main/.claude/skills/bigcommerce-api/references/error-handling.md"
Ensuite dans Claude Code, tapez /error-handling pour l'activer.
open_in_newVoir la source originale
// sauvegarder
Sauvegarde disponible après connexion.
loginSe connecter pour sauvegarder
// informations
Créateurqdhenry
Étoiles 1.3k
Mis à jour1 mars 2026
Format.md
AccèsGratuit
// similaires

Skills Tests et qualité

Voir toutarrow_forward