mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-17 23:56:33 -05:00
Encode all relevant information in the DoltIgnoreConflictError in its error message so it is propagated through remote connections.
This commit is contained in:
@@ -165,18 +165,7 @@ func toStageVErr(err error) errhand.VerboseError {
|
||||
|
||||
return bdr.Build()
|
||||
case doltdb.AsDoltIgnoreInConflict(err) != nil:
|
||||
doltIgnoreConflictError := doltdb.AsDoltIgnoreInConflict(err)
|
||||
bdr := errhand.BuildDError("error: the table %s matches conflicting patterns in dolt_ignore", doltIgnoreConflictError.Table)
|
||||
|
||||
for _, pattern := range doltIgnoreConflictError.TruePatterns {
|
||||
bdr.AddDetails("ignored: %s", pattern)
|
||||
}
|
||||
|
||||
for _, pattern := range doltIgnoreConflictError.FalsePatterns {
|
||||
bdr.AddDetails("not ignored: %s", pattern)
|
||||
}
|
||||
|
||||
return bdr.Build()
|
||||
return errhand.VerboseErrorFromError(err)
|
||||
default:
|
||||
return errhand.BuildDError("Unknown error").AddCause(err).Build()
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package doltdb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
@@ -180,7 +181,22 @@ type DoltIgnoreConflictError struct {
|
||||
}
|
||||
|
||||
func (dc DoltIgnoreConflictError) Error() string {
|
||||
return fmt.Sprintf("dolt_ignore has multiple conflicting rules for %s", dc.Table)
|
||||
var buffer bytes.Buffer
|
||||
buffer.WriteString("the table ")
|
||||
buffer.WriteString(dc.Table)
|
||||
buffer.WriteString(" matches conflicting patterns in dolt_ignore:")
|
||||
|
||||
for _, pattern := range dc.TruePatterns {
|
||||
buffer.WriteString("\nignored: ")
|
||||
buffer.WriteString(pattern)
|
||||
}
|
||||
|
||||
for _, pattern := range dc.FalsePatterns {
|
||||
buffer.WriteString("\nnot ignored: ")
|
||||
buffer.WriteString(pattern)
|
||||
}
|
||||
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func AsDoltIgnoreInConflict(err error) *DoltIgnoreConflictError {
|
||||
|
||||
Reference in New Issue
Block a user