private void OnError(dynamic message, dynamic cb)
        {
            try
            {
                PluginError pluginError = PluginError.Deserialize(message);

                switch (pluginError.Error)
                {
                case Error.AlreadyInGame:
                {
                    Debug.WriteLine($"[Salty Chat] Error: Seems like we are already in an instance, retry...");

                    this.InitializePlugin();

                    break;
                }

                default:
                {
                    Debug.WriteLine($"[Salty Chat] Error: {pluginError.Error} - Message: {pluginError.Message}");

                    break;
                }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"[Salty Chat] Error: We received an error, but couldn't deserialize it:{Environment.NewLine}{e.ToString()}");
            }

            cb("");
        }
Exemple #2
0
        private void OnError(dynamic message, dynamic cb)
        {
            try
            {
                PluginError pluginError = PluginError.Deserialize(message);

                Debug.WriteLine($"[Salty Chat] Error: {pluginError.Error} - Message: {pluginError.Message}");
            }
            catch (Exception e)
            {
                Debug.WriteLine($"[Salty Chat] Error: We received an error, but couldn't deserialize it:{Environment.NewLine}{e.ToString()}");
            }

            cb("");
        }
Exemple #3
0
        public bool TryGetError(out PluginError pluginError)
        {
            try
            {
                pluginError = this.Parameter.ToObject <PluginError>();

                return(true);
            }
            catch
            {
                // do nothing
            }

            pluginError = default;
            return(false);
        }
        /// <summary>
        /// Plugin error
        /// </summary>
        /// <param name="args">[0] - <see cref="PluginCommand"/> as json</param>
        public static void OnPluginError(object[] args)
        {
            try
            {
                PluginError pluginError = Newtonsoft.Json.JsonConvert.DeserializeObject <PluginError>((string)args[0]);

                if (pluginError.Error == Error.AlreadyInGame)
                {
                    VoiceManager.InitiatePlugin(); // try again an hope that the game instance was reset on plugin side
                }
                else
                {
                    RAGE.Chat.Output($"Salty Chat -- Error: {pluginError.Error} - Message: {pluginError.Message}");
                }
            }
            catch
            {
                RAGE.Chat.Output($"Salty Chat -- We got an error, but couldn't deserialize it...");
            }
        }