public PostgresExceptionInfo(PostgresException exception, Regex detailExpression) : this() { if (!string.IsNullOrEmpty(exception.TableName)) { TableName = exception.TableName; } if (!string.IsNullOrEmpty(exception.Detail)) { var match = detailExpression.Match(exception.Detail); if (match.Success) { string columns = match.Groups["KeyColumns"].Value; string values = match.Groups["KeyValues"].Value; string constraintType = match.Groups["ConstraintType"].Value; if (!string.IsNullOrEmpty(columns)) { ColumnNames = columns.Replace("\"", ""); } if (!string.IsNullOrEmpty(values)) { Values = values; } if (!string.IsNullOrEmpty(constraintType)) { ConstraintType = GetConstrainType(constraintType); } } } }
private PostgresExceptionInfo() { TableName = UnknownValue; ColumnNames = UnknownValue; Values = UnknownValue; ConstraintType = PostgresExceptionConstraintType.Unknown; }