update api error messages
This commit is contained in:
parent
309fe80868
commit
2e92d09a2e
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/dailyplayerstats"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg dailyplayerstats.FetchC
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/dailytribestats"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg dailytribestats.FetchCo
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/ennoblement"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg ennoblement.FetchConfig
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -41,7 +41,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, server string) ([]*models.L
|
|||
return nil, fmt.Errorf("Server not found")
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(err, "Internal server error")
|
||||
return nil, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
if s.Status == models.ServerStatusClosed {
|
||||
|
@ -55,7 +55,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, server string) ([]*models.L
|
|||
EnnobledAtGTE: time.Now().Add(-1 * time.Hour),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Cannot load ennoblements for the server '%s' at the moment, please try again later", s.Key)
|
||||
}
|
||||
|
||||
liveEnnoblements := convertToLiveEnnoblements(ennoblements)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/player"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -49,7 +48,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg player.FetchConfig) ([]
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
@ -68,7 +67,7 @@ func (repo *pgRepository) FetchNameChanges(ctx context.Context, code models.Vers
|
|||
Where("player_id IN (?)", pg.In(playerID)).
|
||||
Order("change_date ASC").
|
||||
Select(); err != nil && err != pg.ErrNoRows {
|
||||
return nil, errors.Wrap(err, "Internal server error")
|
||||
return nil, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
m := make(map[int][]*models.PlayerNameChange)
|
||||
|
@ -89,7 +88,7 @@ func (repo *pgRepository) FetchPlayerServers(ctx context.Context, code models.Ve
|
|||
Where("player_id IN (?)", pg.In(playerID)).
|
||||
Group("player_id").
|
||||
Select(&data); err != nil && err != pg.ErrNoRows {
|
||||
return nil, errors.Wrap(err, "Internal server error")
|
||||
return nil, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
m := make(map[int][]string)
|
||||
|
@ -107,7 +106,7 @@ func (repo *pgRepository) SearchPlayer(ctx context.Context, cfg player.SearchPla
|
|||
Column("key").
|
||||
Where("version_code = ?", cfg.Version).
|
||||
Select(); err != nil {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
var query *orm.Query
|
||||
|
@ -152,7 +151,7 @@ func (repo *pgRepository) SearchPlayer(ctx context.Context, cfg player.SearchPla
|
|||
err = base.Select(&res)
|
||||
}
|
||||
if err != nil && err != pg.ErrNoRows {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/playerhistory"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg playerhistory.FetchConf
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -2,6 +2,7 @@ package repository
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
|
@ -46,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg server.FetchConfig) ([]
|
|||
err = query.Select()
|
||||
}
|
||||
if err != nil && err != pg.ErrNoRows {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/serverstats"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -43,7 +42,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg serverstats.FetchConfig
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/tribe"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -44,7 +43,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg tribe.FetchConfig) ([]*
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
@ -58,7 +57,7 @@ func (repo *pgRepository) SearchTribe(ctx context.Context, cfg tribe.SearchTribe
|
|||
Column("key").
|
||||
Where("version_code = ?", cfg.Version).
|
||||
Select(); err != nil {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
var query *orm.Query
|
||||
|
@ -95,7 +94,7 @@ func (repo *pgRepository) SearchTribe(ctx context.Context, cfg tribe.SearchTribe
|
|||
err = base.Select(&res)
|
||||
}
|
||||
if err != nil && err != pg.ErrNoRows {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/tribechange"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg tribechange.FetchConfig
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/tribehistory"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -48,7 +47,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg tribehistory.FetchConfi
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -2,6 +2,7 @@ package repository
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
|
@ -43,7 +44,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg version.FetchConfig) ([
|
|||
err = query.Select()
|
||||
}
|
||||
if err != nil && err != pg.ErrNoRows {
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/go-pg/pg/v10"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tribalwarshelp/api/village"
|
||||
"github.com/tribalwarshelp/shared/models"
|
||||
)
|
||||
|
@ -51,7 +50,7 @@ func (repo *pgRepository) Fetch(ctx context.Context, cfg village.FetchConfig) ([
|
|||
if strings.Contains(err.Error(), `relation "`+cfg.Server) {
|
||||
return nil, 0, fmt.Errorf("Server not found")
|
||||
}
|
||||
return nil, 0, errors.Wrap(err, "Internal server error")
|
||||
return nil, 0, fmt.Errorf("Internal server error")
|
||||
}
|
||||
|
||||
return data, total, nil
|
||||
|
|
Reference in New Issue