SDK Golang v2.x

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Error Handling #

All methods return an "error" struct, which holds a non-nil value if the call failed. Error structs are all of type KuzzleError.

The KuzzleError type implements the standard error interface, and adds the following properties to it:

Property Type Description
Status int Status following HTTP Standards
Stack string Error stacktrace (Only in development mode)

You can find a detailed list of possible errors messages and statuses in the documentation API.

Example #

Copied to clipboard!
err := kuzzle.Index.Create("nyc-open-data", nil)
if err != nil {
  // Type assertion of error to KuzzleError
  if err.(types.KuzzleError).Status == 400 {
    fmt.Println("Try with another name!")