Toggle Developers
HomeAcademy
  • Welcome
  • GraphQL
    • Getting started
    • Exploring our API
    • Authentication
    • API playground
    • Error handling
  • Key concepts
    • Overview
      • Orders, Transactions & Line Items
      • Card number formats
  • Basics
    • Create a card
    • Check a card balance
    • Redeem a card
  • Webhooks
    • Overview
      • Getting started
      • Authentication & responses
    • Events
      • Card.balance_adjusted
      • Card.card_reference_updated
      • Card.expiry_reminder
      • Card.registered
      • Card.send_recipient_email
      • Card.resend_recipient_email
      • Order.created
      • Order.cancelled
      • Order.send_receipt_email
      • Order.send_cancellation_email
      • Payment.failed
      • Payment.review_opened
      • Fulfilment.dispatched
  • Partner Guides
    • EPOS & Ordering
      • Overview
      • Accreditation
      • Configuration variables
      • Playground examples
      • Physical card orders
      • Custom validity rules
      • Balance check
      • Redemptions & top-ups
      • Reversals
    • Guest gratuity
      • Overview
      • Accreditation
      • Configuration variables
      • Playground examples
      • Creating a card
      • Cancelling a card
      • Register a card
    • CRM
      • Overview
      • Historic data via GraphQL
      • Real time data via webhooks
Powered by GitBook
On this page
  1. GraphQL

Error handling

How Toggle returns error responses

Toggle returns descriptive messages for any returned errors (as opposed to error codes or numbers).

For this reason, we recommend that you shouldn't try to re-interpret error strings to your own UI, and instead use them verbatim.

Here's an example error response:

{
  "errors": [
    {
      "message": "validation",
      "locations": [
        {
          "line": 2,
          "column": 29
        }
      ],
      "validation": {
        "currency": [
          "This field is required"
        ]
      },
      "customer_facing": false
    }
  ],
  "data": {
    "createBalanceAdjustment": null
  }
}
PreviousAPI playgroundNextOverview

Last updated 3 years ago