code: func (m *Message) validate() error {
  	// Message should no be empty
  	if m.Message == "" {
  		return ErrMessageEmpty
  	}
  
  	// Validate message length
  	if utf8.RuneCountInString(m.Message) > MessageMaxLength {
  		return ErrMessageTooLong
  	}
  
  	// Validate Title field length
  	if utf8.RuneCountInString(m.Title) > MessageTitleMaxLength {
  		return ErrMessageTitleTooLong
  	}
  
  	// Validate URL field
  	if utf8.RuneCountInString(m.URL) > MessageURLMaxLength {
  		return ErrMessageURLTooLong
  	}
  
  	// Validate URL title field
  	if utf8.RuneCountInString(m.URLTitle) > MessageURLTitleMaxLength {
  		return ErrMessageURLTitleTooLong
  	}
  
  	// URLTitle should not be set with an empty URL
  	if m.URL == "" && m.URLTitle != "" {
  		return ErrEmptyURL
  	}
  
  	// Validate priorities
  	if m.Priority > PriorityEmergency || m.Priority < PriorityLowest {
  		return ErrInvalidPriority
  	}
  
  	// Validate emergency priority
  	if m.Priority == PriorityEmergency {
  		if m.Retry == 0 || m.Expire == 0 {
  			return ErrMissingEmergencyParameter
  		}
  	}
  
  	// Test device name
  	if m.DeviceName != "" {
  		if deviceNameRegexp.MatchString(m.DeviceName) == false {
  			return ErrInvalidDeviceName
  		}
  	}
  
  	return nil
  }
docs: // Validate the message values.