Documentation ¶
Index ¶
- Constants
- Variables
- func AppendError(err error, nonCriticalErrors []error) ([]error, error)
- func HandleError(err error) ([]error, error)
- func HandleHTTPError(err error) int
- func HandleInternalError(response *restful.Response, err error)
- func IsForbiddenError(err error) bool
- func IsNotFoundError(err error) bool
- func LocalizeError(err error) error
- func MergeErrors(errorArraysToMerge ...[]error) (mergedErrors []error)
Constants ¶
const ( MSG_DEPLOY_NAMESPACE_MISMATCH_ERROR = "MSG_DEPLOY_NAMESPACE_MISMATCH_ERROR" MSG_DEPLOY_EMPTY_NAMESPACE_ERROR = "MSG_DEPLOY_EMPTY_NAMESPACE_ERROR" MSG_LOGIN_UNAUTHORIZED_ERROR = "MSG_LOGIN_UNAUTHORIZED_ERROR" MSG_ENCRYPTION_KEY_CHANGED = "MSG_ENCRYPTION_KEY_CHANGED" MSG_DASHBOARD_EXCLUSIVE_RESOURCE_ERROR = "MSG_DASHBOARD_EXCLUSIVE_RESOURCE_ERROR" MSG_TOKEN_EXPIRED_ERROR = "MSG_TOKEN_EXPIRED_ERROR" )
Errors that can be used directly without localizing
Variables ¶
var NonCriticalErrors = []int32{http.StatusForbidden, http.StatusUnauthorized}
NonCriticalErrors is an array of error statuses, that are non-critical. That means, that this error can be silenced and displayed to the user as a warning on the frontend side.
Functions ¶
func AppendError ¶
AppendError handles single error, that occurred during API GET call. If it is not critical, then it will be returned as a part of error array. Otherwise, it will be returned as a second value. Usage of this functions allows to distinguish critical errors from non-critical ones. It is needed to handle them in a different way.
func HandleError ¶
HandleError handles single error, that occurred during API GET call. If it is not critical, then it will be returned as a part of error array. Otherwise, it will be returned as a second value. Usage of this functions allows to distinguish critical errors from non-critical ones. It is needed to handle them in a different way.
func HandleHTTPError ¶ added in v1.10.0
Handle HTTP Errors more accurately based on the localized consts
func HandleInternalError ¶ added in v1.8.1
HandleInternalError writes the given error to the response and sets appropriate HTTP status headers.
func IsForbiddenError ¶ added in v1.8.1
IsForbiddenError returns true if given error has code 403, false otherwise.
func IsNotFoundError ¶ added in v1.8.1
IsNotFoundError returns true when the given error is 404-NotFound error.
func LocalizeError ¶
LocalizeError returns error code (string) that can be used by frontend to localize error message.
Types ¶
This section is empty.