Closed daved closed 8 years ago
I like this, but it's probably a bit verbose.
How about adding a newTxError(migration, err)
function:
func newTxError(migration *PlannedMigration, err error) error {
return &TxError{
Migration: migration.Migration,
Err: err,
}
}
This would allow you to replace all these blocks:
err := &TxError{
Migration: migration.Migration,
Err: err,
}
return applied, err
By this:
return applied, newTxError(migration, err)
Which keeps the code much more compact, less duplicated and more readable.
Thanks for the correction; This is done.
Ok, looking good for me. Merging!
Probably also need to backport this to https://github.com/rubenv/modl-migrate
Oh and thanks a lot, always a joy to land excellent pull requests!
This PR will improve the clarity of transaction-related errors by associating messages with a particular migration id. No additional tests have been added at this time.
For example, this:
will now produce:
go test passes, but I will need direction from @rubenv regarding whether or not additional testing is desirable and, if so, what is the preference for the design/approach of such testing.