Add custom TxError to add clarity to tx-related error messages.#24
Merged
rubenv merged 2 commits intorubenv:masterfrom Feb 24, 2016
Merged
Add custom TxError to add clarity to tx-related error messages.#24rubenv merged 2 commits intorubenv:masterfrom
rubenv merged 2 commits intorubenv:masterfrom
Conversation
Owner
|
I like this, but it's probably a bit verbose. How about adding a 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, errBy this: return applied, newTxError(migration, err)Which keeps the code much more compact, less duplicated and more readable. |
Contributor
Author
|
Thanks for the correction; This is done. |
Owner
|
Ok, looking good for me. Merging! Probably also need to backport this to https://github.com/rubenv/modl-migrate |
rubenv
added a commit
that referenced
this pull request
Feb 24, 2016
Add custom TxError to add clarity to tx-related error messages.
Owner
|
Oh and thanks a lot, always a joy to land excellent pull requests! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.