Skip to content

Commit

Permalink
fix: Fix error text for driver.ErrBadConn in go-sql-spanner (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent authored Jun 2, 2024
2 parents 895711c + af401b7 commit 8aabdc1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/ddlctl/show/ddlctl_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package show

import (
"context"
"database/sql/driver"
"errors"
"io"
"os"

Expand Down Expand Up @@ -49,6 +51,9 @@ func Show(ctx context.Context, dialect string, dsn string) (ddl string, err erro

db, err := sqlz.OpenContext(ctx, driverName, dsn)
if err != nil {
if dialect == spanddl.Dialect && errors.Is(err, driver.ErrBadConn) {
err = apperr.Errorf("error such as 'Instance not found' or 'Database not found' might have occurred: %w", err)
}
return "", apperr.Errorf("sqlz.OpenContext: %w", err)
}
defer func() {
Expand Down

0 comments on commit 8aabdc1

Please sign in to comment.