Wrap errors
This commit is contained in:
@ -16,7 +16,7 @@ type Templates struct {
|
|||||||
func NewTemplates(funcMap template.FuncMap) (*Templates, error) {
|
func NewTemplates(funcMap template.FuncMap) (*Templates, error) {
|
||||||
templates, err := fs.Glob(web.Templates, "*.tpl")
|
templates, err := fs.Glob(web.Templates, "*.tpl")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("glob: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result := &Templates{
|
result := &Templates{
|
||||||
|
@ -22,12 +22,12 @@ func Connect(server string, user string, password string, database string) (*Dat
|
|||||||
connString := fmt.Sprintf("postgres://%s:%s@%s/%s", user, password, server, database)
|
connString := fmt.Sprintf("postgres://%s:%s@%s/%s", user, password, server, database)
|
||||||
conn, err := sql.Open("pgx", connString)
|
conn, err := sql.Open("pgx", connString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("open connection: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
goose.SetBaseFS(migrations)
|
goose.SetBaseFS(migrations)
|
||||||
if err = goose.Up(conn, "schema"); err != nil {
|
if err = goose.Up(conn, "schema"); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("migrate: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Database{
|
return &Database{
|
||||||
|
Reference in New Issue
Block a user