code: func createError(req *Request, r interface{}) *Error {
  	if r == nil {
  		return nil
  	}
  
  	var kiteErr *Error
  	switch err := r.(type) {
  	case *Error:
  		kiteErr = err
  	case *dnode.ArgumentError:
  		kiteErr = &Error{
  			Type:    "argumentError",
  			Message: err.Error(),
  		}
  	default:
  		kiteErr = &Error{
  			Type:    "genericError",
  			Message: fmt.Sprint(r),
  		}
  	}
  
  	if kiteErr.RequestID == "" && req != nil {
  		kiteErr.RequestID = req.ID
  	}
  
  	return kiteErr
  }
docs: // createError creates a new kite.Error for the given r variable