code: func (r *successResponse) check(err error) (statusCode int) {
  	if err == nil {
  		r.Success = true
  		return 0
  	}
  
  	cause := errors.Cause(err)
  
  	// Determine HTTP status code based on the error type.
  	switch cause.(type) {
  	case pilosa.BadRequestError:
  		statusCode = http.StatusBadRequest
  	case pilosa.ConflictError:
  		statusCode = http.StatusConflict
  	case pilosa.NotFoundError:
  		statusCode = http.StatusNotFound
  	default:
  		statusCode = http.StatusInternalServerError
  	}
  
  	r.Success = false
  	r.Error = &Error{Message: err.Error()}
  
  	return statusCode
  }
docs: // check determines success or failure based on the error.
  // It also returns the corresponding http status code.