protected bool IsErrorHandled(object currentObject, JsonContract contract, object keyValue, IJsonLineInfo lineInfo, [Nullable(1)] string path, [Nullable(1)] Exception ex)
{
ErrorContext errorContext = this.GetErrorContext(currentObject, keyValue, path, ex);
if (this.TraceWriter != null && this.TraceWriter.LevelFilter >= TraceLevel.Error && !errorContext.Traced)
{
errorContext.Traced = true;
string text = (base.GetType() == typeof(JsonSerializerInternalWriter)) ? "Error serializing" : "Error deserializing";
if (contract != null)
{
string str = text;
string str2 = " ";
Type underlyingType = contract.UnderlyingType;
text = str + str2 + ((underlyingType != null) ? underlyingType.ToString() : null);
}
text = text + ". " + ex.Message;
if (!(ex is JsonException))
{
text = JsonPosition.FormatMessage(lineInfo, path, text);
}
this.TraceWriter.Trace(TraceLevel.Error, text, ex);
}
if (contract != null && currentObject != null)
{
contract.InvokeOnError(currentObject, this.Serializer.Context, errorContext);
}
if (!errorContext.Handled)
{
this.Serializer.OnError(new ErrorEventArgs(currentObject, errorContext));
}
return(errorContext.Handled);
}