GODT-1210: "free user" banner

This commit is contained in:
Alexander Bilyak
2021-10-07 09:28:20 +00:00
committed by Jakub
parent 1141ea27e2
commit c5699700b3
7 changed files with 17 additions and 5 deletions

View File

@ -26,6 +26,8 @@ var (
ErrBad2FACode = errors.New("incorrect 2FA code")
ErrBad2FACodeTryAgain = errors.New("incorrect 2FA code: please try again")
ErrPaidPlanRequired = errors.New("paid subscription plan is required")
)
type ErrUnprocessableEntity struct {

View File

@ -30,7 +30,8 @@ import (
)
const (
errCodeUpgradeApplication = 5003
errCodeUpgradeApplication = 5003
errCodeAuthPaidPlanRequired = 10004
)
type Error struct {
@ -60,6 +61,8 @@ func (m *manager) catchAPIError(_ *resty.Client, res *resty.Response) error {
if m.cfg.UpgradeApplicationHandler != nil {
m.cfg.UpgradeApplicationHandler()
}
case apiErr.Code == errCodeAuthPaidPlanRequired:
err = ErrPaidPlanRequired
case res.StatusCode() == http.StatusUnprocessableEntity:
err = ErrUnprocessableEntity{apiErr}
default: