Skip to content

Commit

Permalink
Add additional information in source.ErrDuplicateMigration struct
Browse files Browse the repository at this point in the history
  • Loading branch information
dhui committed Dec 24, 2019
1 parent 09f532b commit 525949d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions source/errors.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package source

import "os"

// ErrDuplicateMigration is an error type for reporting duplicate migration
// files.
type ErrDuplicateMigration struct {
Filename string
Migration
os.FileInfo
}

// Error implements error interface.
func (e ErrDuplicateMigration) Error() string {
return "duplicate migration file: " + e.Filename
return "duplicate migration file: " + e.Name()
}
3 changes: 2 additions & 1 deletion source/httpfs/partialdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (p *PartialDriver) Init(fs http.FileSystem, path string) error {

if !ms.Append(m) {
return source.ErrDuplicateMigration{
Filename: file.Name(),
Migration: *m,
FileInfo: file,
}
}
}
Expand Down

0 comments on commit 525949d

Please sign in to comment.