Merge pull request #1510 from alrs/doltcore-actions-errs

libraries/doltcore/env/actions: error handling
This commit is contained in:
Zach Musgrave
2021-04-06 12:22:16 -07:00
committed by GitHub
3 changed files with 8 additions and 2 deletions
+3
View File
@@ -211,6 +211,9 @@ func createBranch(ctx context.Context, dbData env.DbData, newBranch, startingPoi
// updateRootsForBranch writes the roots needed for a checkout and returns the updated work and staged hash.
func updateRootsForBranch(ctx context.Context, dbData env.DbData, dref ref.DoltRef, brName string) (wrkHash hash.Hash, stgHash hash.Hash, err error) {
hasRef, err := dbData.Ddb.HasRef(ctx, dref)
if err != nil {
return hash.Hash{}, hash.Hash{}, err
}
if !hasRef {
return hash.Hash{}, hash.Hash{}, doltdb.ErrBranchNotFound
}
+2 -2
View File
@@ -494,7 +494,7 @@ func TestInferSchema(t *testing.T) {
assert.Equal(t, expectedType, col.TypeInfo, "column: %s - expected: %s got: %s", col.Name, expectedType.String(), col.TypeInfo.String())
return false, nil
})
assert.NoError(t, err)
require.NoError(t, err)
if test.nullableCols == nil {
test.nullableCols = set.NewStrSet(nil)
@@ -505,7 +505,7 @@ func TestInferSchema(t *testing.T) {
assert.True(t, idx == -1 == test.nullableCols.Contains(col.Name), "%s unexpected nullability", col.Name)
return false, nil
})
assert.NoError(t, err)
require.NoError(t, err)
})
}
}
+3
View File
@@ -227,6 +227,9 @@ func getUnionedTables(ctx context.Context, tables []string, stagedRoot, headRoot
// resetDocs resets the working and staged docs with docs from head.
func resetDocs(ctx context.Context, dbData env.DbData, headRoot *doltdb.RootValue, staged *doltdb.RootValue, docs doltdocs.Docs) (newStgRoot *doltdb.RootValue, err error) {
docs, err = doltdocs.GetDocsFromRoot(ctx, headRoot, doltdocs.GetDocNamesFromDocs(docs)...)
if err != nil {
return nil, err
}
working, err := env.WorkingRoot(ctx, dbData.Ddb, dbData.Rsr)
if err != nil {