Audit all call sites where `fmt.Errorf()` was being used and switch to errwrap.
This commit is contained in:
parent
9ab60ecc7b
commit
4570460f4e
|
@ -8,6 +8,7 @@ import (
|
|||
"sync"
|
||||
"unicode"
|
||||
|
||||
"github.com/hashicorp/errwrap"
|
||||
_ "github.com/lib/pq" //PostgreSQL db
|
||||
)
|
||||
|
||||
|
@ -89,7 +90,7 @@ func (c *Config) NewClient() (*Client, error) {
|
|||
func (c *Client) Connect() (*sql.DB, error) {
|
||||
db, err := sql.Open("postgres", c.connStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error connecting to PostgreSQL server: %v", err)
|
||||
return nil, errwrap.Wrapf("Error connecting to PostgreSQL server: {{err}}", err)
|
||||
}
|
||||
|
||||
return db, nil
|
||||
|
|
|
@ -374,7 +374,7 @@ func resourcePostgreSQLRoleReadImpl(d *schema.ResourceData, meta interface{}) er
|
|||
err = conn.QueryRow("SELECT COALESCE(passwd, '') FROM pg_catalog.pg_shadow AS s WHERE s.usename = $1", roleId).Scan(&rolePassword)
|
||||
switch {
|
||||
case err == sql.ErrNoRows:
|
||||
return fmt.Errorf("PostgreSQL role (%s) not found in shadow database: {{err}}", roleId)
|
||||
return errwrap.Wrapf(fmt.Errorf("PostgreSQL role (%s) not found in shadow database: {{err}}", roleId), err)
|
||||
case err != nil:
|
||||
return errwrap.Wrapf("Error reading role: {{err}}", err)
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue