Skip to content

Error handling

Errors are generally handled through a graphql response, not through http status calls.

HTTP status codes

The graphql endpoint will always respond with a 200 OK as long as it's operational. A 500 or 502 may occur if the backend is down or in maintenance.

Graphql errors

Information on errors is contained in the errors array in a graphql response. Each element in the array represents an invididual error that may have occured in the query. Note that some fields of the query may fail while others may succeed. You should handle each error appropriately.

Known errors

There are certain errors that occur regularly (such as a wrong password for a login). These are given a special id (for example #userNotFound when the supplied email isn't connected to a login). That id is returned should such an error occur. A translated message that can be displayed to the user is also supplied when appropiate.

{
  login(email: "doesnt@Aexi.dst", password: "test")
}

Will lead to:

{
  "errors": [
    {
      "message": {
        "id": "#userNotFound",
        "text": {
          "de": "Die eingegebene E-Mail Adresse hat keinen verbundenen Account. Bist Du sicher, dass Du dich registriert hast?",
          "en": "That email address doesn’t have an associated user account. Are you sure you registered?"
        }
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "login"
      ]
    }
  ],
  "data": {
    "login": null
  }
}

Exceptional errors

Other errors (normally called internal server errors) are not expected and may be caused by a bug. To make sure no potentially exploitable info is leaked to users, only an id that uniquely identifies that exception is returned. You can provide us with that id so we can directly investigate that issue.

You can force such an error using the error query to make sure you are handling them adequately.

{
    error
}
{
  "errors": [
    {
      "id": "aa76aaef-a2d0-4876-964a-32a3cc992b87",
      "message": {
        "id": "#internalError",
        "text": {
          "de": "Interner Fehler"
        }
      },
      "locations": [
        {
          "line": 1,
          "column": 2
        }
      ],
      "path": [
        "error"
      ]
    }
  ],
  "data": {
    "error": null
  }
}