code: func EncodeError(ctx context.Context, err error, w http.ResponseWriter) {
  	if err == nil {
  		return
  	}
  
  	if pe, ok := err.(*platform.Error); ok {
  		code := platform.ErrorCode(pe)
  		httpCode, ok := statusCodePlatformError[code]
  		if !ok {
  			httpCode = http.StatusBadRequest
  		}
  		w.Header().Set(PlatformErrorCodeHeader, code)
  		w.Header().Set("Content-Type", "application/json; charset=utf-8")
  		w.WriteHeader(httpCode)
  		b, _ := json.Marshal(&platform.Error{
  			Code: code,
  			Op:   platform.ErrorOp(pe),
  			Msg:  platform.ErrorMessage(pe),
  			Err:  pe.Err,
  		})
  		_, _ = w.Write(b)
  		return
  	}
  	e, ok := err.(kerrors.Error)
  	if !ok {
  		e = kerrors.Error{
  			Reference: kerrors.InternalError,
  			Err:       err.Error(),
  		}
  	}
  	encodeKError(e, w)
  }
docs: // EncodeError encodes err with the appropriate status code and format,
  // sets the X-Influx-Error and X-Influx-Reference headers on the response,
  // and sets the response status to the corresponding status code.