storj/satellite/console/consoleweb/consoleql/consoleerrors.go

34 lines
854 B
Go
Raw Normal View History

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package consoleql
import (
"github.com/zeebo/errs"
"storj.io/storj/satellite/console"
)
// Error messages
const (
internalErrDetailedMsg = "It looks like we had a problem on our end. Please try again"
2019-12-09 13:20:44 +00:00
projectLimitErrMsg = "Sorry, during the Vanguard release you have a limited number of projects"
)
// errConsoleInternalDetailed describes detailed error message for internal error
var errConsoleInternalDetailed = errs.New(internalErrDetailedMsg)
2019-12-09 13:20:44 +00:00
var errProjectLimit = errs.New(projectLimitErrMsg)
// HandleError returns detailed error if such error handles
func HandleError(err error) error {
switch {
case console.Error.Has(err):
return errConsoleInternalDetailed
2019-12-09 13:20:44 +00:00
case console.ErrProjLimit.Has(err):
return errProjectLimit
default:
return err
}
}