private static void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs errorArgs) { var currentError = errorArgs.ErrorContext.Error.Message; errorArgs.ErrorContext.Handled = true; Console.WriteLine("Error: " + currentError); }
static void ErrorHandler(object?sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) { if (args.ErrorContext.Member?.Equals(nameof(GithubPatcherSettings.PatcherVersioning)) ?? false) { args.ErrorContext.Handled = true; } }
void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs errorArgs) { var currentError = errorArgs.ErrorContext.Error.Message; errorArgs.ErrorContext.Handled = true; _log.Error(currentError); }
public static void DeserializationErrorHandler(object sender, ErrorEventArgs errorArgs) { var currentError = errorArgs.ErrorContext.Error.Message; Console.WriteLine($"ERROR: {currentError}"); errorArgs.ErrorContext.Handled = true; }
public void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs eventArgs) { var currentError = eventArgs.ErrorContext.Error.Message; Messages.Add(currentError); eventArgs.ErrorContext.Handled = true; }
private static void JsonSerializer_Error(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { if (e.ErrorContext.Path == "video.translation") { e.ErrorContext.Handled = true; } }
static void OnSerializerError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { if (ignoreSerializationExceptions) { e.ErrorContext.Handled = true; } }
//TODO: log private static void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { var currentError = e.ErrorContext.Error.Message; e.ErrorContext.Handled = true; //Console.WriteLine($"Deserialization error {currentError}"); //@class.Log(LogLevel.Error, 0, $"deserialization error {currentError}", ex, null); }
private static void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { var currentError = e.ErrorContext.Error.Message; Main.DebugLog(currentError); e.ErrorContext.Handled = true; }
private static void Serializer_Error(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { // Handle missing enum values if (e.ErrorContext.Error.Message.StartsWith("Error converting value")) { e.ErrorContext.Handled = true; } }
private void Json_Error(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { refreshTranslationFile = true; propertyNames.Add(e.ErrorContext.Member.ToString()); e.ErrorContext.Handled = true; }
//---------------------------------------------------------------------------------------------------------------------------------------------- static void errorHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) { DebugEx.Assert(args.ErrorContext.Error, "JSON deserialization error, Path=" + args.ErrorContext.Path); //mark error as handled if (args != null && args.ErrorContext != null) { args.ErrorContext.Handled = true; } }
private static void Log_JsonErrorHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { e.ErrorContext.Handled = true; if (_logDebug >= LoggingLevel.Verbose) { Process($"json serialization error: {e.ErrorContext.OriginalObject} {e.ErrorContext.Path}"); } }
internal void OnError(Newtonsoft.Json.Serialization.ErrorEventArgs e) { EventHandler <Newtonsoft.Json.Serialization.ErrorEventArgs> error = this.Error; if (error == null) { return; } error((object)this, e); }
public static void HandleDeserializationError(object sender, ErrorEventArgs e) { var currentError = e.ErrorContext.Error.Message; if (e.CurrentObject is ScriptAction) { ((ScriptAction)e.CurrentObject).SerializationError = currentError; } e.ErrorContext.Handled = true; }
private void Serializer_Error(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { // Currently Coverlet is serializing the BranchKey object as this string. I think in error. // This value is not used currently to display coverage results. // This allows the results to be deserialized successfully, ignoring this error of not being able to deserialize this object. if (e.ErrorContext.Member is string stringMember && stringMember == "Coverlet.Core.Instrumentation.BranchKey") { e.ErrorContext.Handled = true; } }
private static void IgnoreError(object sender, ErrorEventArgs e) { if (e.CurrentObject is Page p && Regex.IsMatch(e.ErrorContext.Path, @"Pages\.\$values\[[0-9]+\]\.Elements\.\$type")) // If type is wrong { p.Elements.Add(new ContentElement()); // oh no e.ErrorContext.Handled = true; } #if !DEBUG e.ErrorContext.Handled = true; #endif }
private void handleParsingError(object sender, ErrorEventArgs args, Dictionary <string, string> errorMessages, string currentGame) { // only handle error once if (args.CurrentObject != args.ErrorContext.OriginalObject) { return; } string errorMessage = "Error trying to deserialize " + args.CurrentObject.ToString() + ": " + args.ErrorContext.Error.Message; appendError(errorMessages, currentGame, errorMessage); args.ErrorContext.Handled = true; }
public static void OnSerializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { Logger.Current.Error(e.ErrorContext.Error, $"Serializing: {e?.CurrentObject?.GetType().FullName}"); var statusCode = GetExceptionStatusCode(e.ErrorContext.Error); if (statusCode.HasValue) { e.ErrorContext.Handled = true; HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.StatusCode = (int)statusCode.Value; HttpContext.Current.Response.End(); } }
private static void JsonSerializer_Error(object sender, ErrorEventArgs errorEventArgs) { if (errorEventArgs.ErrorContext.Error.InnerException is ArgumentException) { // ReSharper disable once LocalNameCapturedOnly // ReSharper disable once RedundantAssignment if (errorEventArgs.CurrentObject is Hotkey hotkey) { if (errorEventArgs.ErrorContext.Path.EndsWith(nameof(hotkey.Action))) { errorEventArgs.ErrorContext.Handled = true; } } } if (!errorEventArgs.ErrorContext.Handled) { logger.Error("JsonSerializer error.", errorEventArgs.ErrorContext.Error); } }
/// <summary> /// Skip deserialization errors, prevents throwing of an exception during deserialization, instead it uses defaults. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void HandleDeserializationError(object sender, ErrorEventArgs args) { //var currentError = args.ErrorContext.Error.Message; args.ErrorContext.Handled = true; }
private static void SerializationErrorHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) { Log.Exception(args.ErrorContext.Error); args.ErrorContext.Handled = true; }
private void SerializationError(object sender, ErrorEventArgs e) { _logger.Log("Failed to serialize leaderBoard token data.", LogLevel.Debug); _logger.Log(e, LogLevel.Trace); }
private static void HandleError(object sender, ErrorEventArgs e) { e.ErrorContext.Handled = true; }
public void HandleDeserializationError(object sender, ErrorEventArgs args) { Log.WriteException(args.ErrorContext.Error); args.ErrorContext.Handled = true; }
private static void DeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { throw new JsonSerializationException("Error deserializing", e.ErrorContext.Error); }
private static void JsonErrorHandler(object x, Newtonsoft.Json.Serialization.ErrorEventArgs error) => error.ErrorContext.Handled = true;
private static void Error(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs errorEventArgs) { Console.WriteLine(errorEventArgs.ErrorContext.Error.Message); errorEventArgs.ErrorContext.Handled = true; }
private static void OnError( object sender, ErrorEventArgs e ) { if ( e.ErrorContext.Member.ToStringOrEmpty() == "private" ) { ( ( ExtClass ) e.CurrentObject ).@private = false; e.ErrorContext.Handled = true; } }
void JsonError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { JsonLogger.LogError(e.ErrorContext.Error.Message); }
private static void HandleError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) { throw args.ErrorContext.Error; }
/// <summary> /// Handler for deserialization error /// </summary> /// <param name="sender">Sender object</param> /// <param name="errorArgs">Error arguments</param> private void HandleDeserializationError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs errorArgs) { OnDeserializationError?.Invoke(sender, errorArgs); }