Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻 improve error message for invalid source, database, resolves: #1102 #1103

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -149,15 +149,15 @@ 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

m.sourceName = sourceName

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

Expand Down
Loading