From 1566dd06cd58a6e58ca562b85b4a87988c3281fb Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Tue, 7 Aug 2018 15:46:33 -0700 Subject: [PATCH] Pass the error through instead of overriding it --- migrate.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/migrate.go b/migrate.go index 9d76978..1a3ba6a 100644 --- a/migrate.go +++ b/migrate.go @@ -395,16 +395,16 @@ func (m *Migrate) read(from int, to int, ret chan<- interface{}) { // check if from version exists if from >= 0 { - if m.versionExists(suint(from)) != nil { - ret <- os.ErrNotExist + if err := m.versionExists(suint(from)); err != nil { + ret <- err return } } // check if to version exists if to >= 0 { - if m.versionExists(suint(to)) != nil { - ret <- os.ErrNotExist + if err := m.versionExists(suint(to)); err != nil { + ret <- err return } } @@ -507,8 +507,8 @@ func (m *Migrate) readUp(from int, limit int, ret chan<- interface{}) { // check if from version exists if from >= 0 { - if m.versionExists(suint(from)) != nil { - ret <- os.ErrNotExist + if err := m.versionExists(suint(from)); err != nil { + ret <- err return } } @@ -599,8 +599,8 @@ func (m *Migrate) readDown(from int, limit int, ret chan<- interface{}) { // check if from version exists if from >= 0 { - if m.versionExists(suint(from)) != nil { - ret <- os.ErrNotExist + if err := m.versionExists(suint(from)); err != nil { + ret <- err return } }