def ensure_valid_callback_name!(event_type, name)
      message = if wrong_event_name?(name, event_type)
        EVENT_CALLBACK_CONFLICT_MESSAGE % {
          type: "on_#{event_type}",
          name: name
        }
      elsif wrong_state_name?(name, event_type)
        STATE_CALLBACK_CONFLICT_MESSAGE % {
          type: "on_#{event_type}",
          name: name
        }
      elsif !callback_names.include?(name)
        CALLBACK_INVALID_MESSAGE % {
          name: name,
          callbacks: callback_names.to_a.inspect
        }
      else
        nil
      end
      message && raise_invalid_callback_error(message)
    end
def ensure_valid_callback_name!(event_type, name)
      message = if wrong_event_name?(name, event_type)
        EVENT_CALLBACK_CONFLICT_MESSAGE % {
          type: "on_#{event_type}",
          name: name
        }
      elsif wrong_state_name?(name, event_type)
        STATE_CALLBACK_CONFLICT_MESSAGE % {
          type: "on_#{event_type}",
          name: name
        }
      elsif !callback_names.include?(name)
        CALLBACK_INVALID_MESSAGE % {
          name: name,
          callbacks: callback_names.to_a.inspect
        }
      else
        nil
      end
      message && raise_invalid_callback_error(message)
    end
Raise error when the callback name is not valid

 @example
   ensure_valid_callback_name!(HookEvent::Enter, ":state_name")

 @raise [FiniteMachine::InvalidCallbackNameError]

 @return [nil]

 @api public