/// <inheritdoc /> protected override void DestructureException( OracleLpException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(OracleLpException.Type), exception.Type.GetName()); propertyBag.AddProperty(nameof(OracleLpException.Error), exception.Error.GetName()); }
/// <inheritdoc /> protected override void DestructureException( MySqlException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(MySqlException.Number), exception.Number); propertyBag.AddProperty(nameof(MySqlException.SqlState), exception.SqlState); propertyBag.AddProperty(nameof(MySqlException.ErrorCode), exception.ErrorCode); }
/// <inheritdoc /> protected override void DestructureException( OracleException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(OracleException.Number), exception.Number); propertyBag.AddProperty(nameof(OracleException.Procedure), exception.Procedure); propertyBag.AddProperty(nameof(OracleException.DataSource), exception.DataSource); propertyBag.AddProperty(nameof(OracleException.Errors), null); propertyBag.AddProperty(nameof(OracleException.IsRecoverable), exception.IsRecoverable); }
private void AppendTypeIfNeed(IExceptionPropertyBag propertyBag, Type type) { if (propertyBag.ContainProperty("Type")) { if (!propertyBag.ContainProperty("$Type")) { propertyBag.AddProperty("$Type", type.FullName); } } else { propertyBag.AddProperty("Type", type.FullName); } }
/// <inheritdoc /> protected override void DestructureException(AggregateException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty( nameof(AggregateException.InnerException), exception.InnerExceptions.Select(destructureExceptionHandle).ToList()); }
/// <inheritdoc /> protected override void DestructureException( NpgsqlException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(NpgsqlException.IsTransient), exception.IsTransient); }
/// <inheritdoc /> protected override void DestructureException( SQLiteException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(SQLiteException.ResultCode), exception.ResultCode.GetName()); }
/// <inheritdoc /> public virtual void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { if (exception is null) { throw new ArgumentNullException(nameof(exception)); } if (propertyBag is null) { throw new ArgumentNullException(nameof(propertyBag)); } if (destructureExceptionHandle is null) { throw new ArgumentNullException(nameof(destructureExceptionHandle)); } propertyBag.AddProperty("Type", exception.GetType().FullName); DestructureCommonExceptionProperties(exception, propertyBag, destructureExceptionHandle, data => data.MapToStrObjDictionary()); }
/// <inheritdoc /> protected override void DestructureException( ReflectionTypeLoadException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty( nameof(ReflectionTypeLoadException.LoaderExceptions), exception.LoaderExceptions.Select(destructureExceptionHandle).ToList()); }
/// <inheritdoc /> public override void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { base.Destructure(exception, propertyBag, destructureExceptionHandle); var argumentException = (ArgumentOutOfRangeException)exception; propertyBag.AddProperty(nameof(ArgumentOutOfRangeException.ActualValue), argumentException.ActualValue); }
/// <inheritdoc /> public override void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { base.Destructure(exception, propertyBag, destructureExceptionHandle); var tce = (TaskCanceledException)exception; propertyBag.AddProperty(nameof(TaskCanceledException.Task), DestructureTask(tce.Task, destructureExceptionHandle)); }
/// <inheritdoc /> public override void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { base.Destructure(exception, propertyBag, destructureExceptionHandle); var typeException = (OracleTypeException)exception; propertyBag.AddProperty(nameof(OracleTypeException.Number), typeException.Number); }
/// <inheritdoc /> protected override void DestructureException( SqlException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(SqlException.ClientConnectionId), exception.ClientConnectionId); propertyBag.AddProperty(nameof(SqlException.Class), exception.Class); propertyBag.AddProperty(nameof(SqlException.LineNumber), exception.LineNumber); propertyBag.AddProperty(nameof(SqlException.Number), exception.Number); propertyBag.AddProperty(nameof(SqlException.Server), exception.Server); propertyBag.AddProperty(nameof(SqlException.State), exception.State); propertyBag.AddProperty(nameof(SqlException.Errors), exception.Errors.Cast <SqlError>().ToArray()); }
/// <inheritdoc /> public override void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { base.Destructure(exception, propertyBag, destructureExceptionHandle); var current = (DbUpdateException)exception; var list = ( from entry in current.Entries let properties = entry.CurrentValues.PropertyNames .Select(entry.Property) .Select(c => new { c.Name, c.OriginalValue, c.CurrentValue, c.IsModified }) .ToList() select new { EntryProperties = properties, entry.State } ).ToList(); propertyBag.AddProperty(nameof(DbUpdateException.Entries), list.ToList()); }
/// <inheritdoc /> public override void Destructure( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { base.Destructure(exception, propertyBag, destructureExceptionHandle); var current = (DbUpdateException)exception; var entryColl = current.Entries?.Select(x => new { EntryProperties = x.Properties.Select(p => new { PropertyName = p.Metadata.Name, p.OriginalValue, p.CurrentValue, p.IsTemporary, p.IsModified }), x.State }).ToList(); propertyBag.AddProperty(nameof(DbUpdateException.Entries), entryColl); }
internal static void DestructureCommonExceptionProperties( Exception exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > innerExceptionDestructurer, Func <IDictionary, object> destructureDataProperty) { if (exception.Data.Count != 0) { propertyBag.AddProperty(nameof(Exception.Data), destructureDataProperty(exception.Data)); } if (!string.IsNullOrWhiteSpace(exception.HelpLink)) { propertyBag.AddProperty(nameof(Exception.HelpLink), exception.HelpLink); } if (exception.HResult != 0) { propertyBag.AddProperty(nameof(Exception.HResult), exception.HResult); } propertyBag.AddProperty(nameof(Exception.Message), exception.Message); propertyBag.AddProperty(nameof(Exception.Source), exception.Source); propertyBag.AddProperty(nameof(Exception.StackTrace), exception.StackTrace); #if NET461 || NET472 if (exception.TargetSite != null) { propertyBag.AddProperty(nameof(Exception.TargetSite), exception.TargetSite.ToString()); } #endif if (exception.InnerException != null) { propertyBag.AddProperty(nameof(Exception.InnerException), innerExceptionDestructurer(exception.InnerException)); } }
/// <inheritdoc /> protected override void DestructureException(OperationCanceledException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(OperationCanceledException.CancellationToken), DestructureCancellationToken(exception.CancellationToken)); }
/// <inheritdoc /> protected override void DestructureException( PostgresException exception, IExceptionPropertyBag propertyBag, Func <Exception, IReadOnlyDictionary <string, object> > destructureExceptionHandle) { propertyBag.AddProperty(nameof(PostgresException.Line), exception.Line); propertyBag.AddProperty(nameof(PostgresException.Position), exception.Position); propertyBag.AddProperty(nameof(PostgresException.Severity), exception.Severity); propertyBag.AddProperty(nameof(PostgresException.SchemaName), exception.SchemaName); propertyBag.AddProperty(nameof(PostgresException.TableName), exception.TableName); propertyBag.AddProperty(nameof(PostgresException.ColumnName), exception.ColumnName); propertyBag.AddProperty(nameof(PostgresException.DataTypeName), exception.DataTypeName); propertyBag.AddProperty(nameof(PostgresException.ConstraintName), exception.ConstraintName); propertyBag.AddProperty(nameof(PostgresException.Where), exception.Where); propertyBag.AddProperty(nameof(PostgresException.Statement.StatementType), exception.Statement.StatementType.GetName()); propertyBag.AddProperty(nameof(PostgresException.Statement.SQL), exception.Statement.SQL); propertyBag.AddProperty(nameof(PostgresException.Statement.OID), exception.Statement.OID); propertyBag.AddProperty(nameof(PostgresException.Statement.Rows), exception.Statement.Rows); propertyBag.AddProperty(nameof(PostgresException.SqlState), exception.SqlState); propertyBag.AddProperty(nameof(PostgresException.Detail), exception.Detail); propertyBag.AddProperty(nameof(PostgresException.Hint), exception.Hint); propertyBag.AddProperty(nameof(PostgresException.IsTransient), exception.IsTransient); propertyBag.AddProperty(nameof(PostgresException.File), exception.File); propertyBag.AddProperty(nameof(PostgresException.Routine), exception.Routine); }