From cabb2db836aeddfc1f6612931897275685bea7bb Mon Sep 17 00:00:00 2001 From: Shion Ichikawa Date: Wed, 5 Jun 2024 22:42:24 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20improve=20e?= =?UTF-8?q?rror=20message=20for=20invalid=20source,=20database,=20resolves?= =?UTF-8?q?:=20#1102?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- migrate.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/migrate.go b/migrate.go index a57dceb5d..7763782a0 100644 --- a/migrate.go +++ b/migrate.go @@ -89,25 +89,25 @@ func New(sourceURL, databaseURL string) (*Migrate, error) { sourceName, err := iurl.SchemeFromURL(sourceURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to parse scheme from source URL: %w", err) } m.sourceName = sourceName databaseName, err := iurl.SchemeFromURL(databaseURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to parse scheme from database URL: %w", err) } m.databaseName = databaseName sourceDrv, err := source.Open(sourceURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to open source, %q: %w", sourceURL, err) } m.sourceDrv = sourceDrv databaseDrv, err := database.Open(databaseURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to open database, %q: %w", databaseURL, err) } m.databaseDrv = databaseDrv @@ -131,7 +131,7 @@ func NewWithDatabaseInstance(sourceURL string, databaseName string, databaseInst sourceDrv, err := source.Open(sourceURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to open source, %q: %w", sourceURL, err) } m.sourceDrv = sourceDrv @@ -149,7 +149,7 @@ func NewWithSourceInstance(sourceName string, sourceInstance source.Driver, data databaseName, err := iurl.SchemeFromURL(databaseURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to parse scheme from database URL: %w", err) } m.databaseName = databaseName @@ -157,7 +157,7 @@ func NewWithSourceInstance(sourceName string, sourceInstance source.Driver, data databaseDrv, err := database.Open(databaseURL) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to open database, %q: %w", databaseURL, err) } m.databaseDrv = databaseDrv