Errors and localization#
Storefront GraphQL uses GraphQL errors for request/authorization failures and response objects for mutation result messages. Both carry stable codes and localized human text.
Surface |
Shape |
|---|---|
GraphQL execution error |
|
Mutation payload message |
|
Client behavior |
Branch on stable codes. Display localized messages. Preserve |
json
{
"errors": [
{
"message": "Localized message",
"extensions": {
"code": "UNAUTHORIZED",
"locale": "en",
"status_code": 401,
"request_id": "018f..."
}
}
]
}
graphql
mutation CustomerLogin($input: CustomerLoginInput!) {
customerLogin(input: $input) {
success
error
response {
code
message
locale
params { key value }
}
}
}