boerrors

package
v0.0.0-...-09780b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBuildOpError

func IsBuildOpError(err error, code BOErrorId) bool

IsBuildOpError returns true if the specified error is BuildOpError with certain code.

Types

type BOErrorId

type BOErrorId int
const (
	ETransientError BOErrorId = 0
	EUnknownError   BOErrorId = 1

	// 'pipelines-as-code-secret' secret doesn't exists in 'build-service' namespace nor Component's one.
	EPaCSecretNotFound BOErrorId = 50
	// Validation of 'pipelines-as-code-secret' secret failed
	EPaCSecretInvalid BOErrorId = 51
	// Pipelines as Code public route to recieve webhook events doesn't exist in expected namespaces.
	EPaCRouteDoesNotExist BOErrorId = 52
	// An attempt to create another PaC repository object that references the same git repository.
	EPaCDuplicateRepository BOErrorId = 53
	// Git repository url isn't allowed
	EPaCNotAllowedRepositoryUrl BOErrorId = 54

	// Happens when Component source repository is hosted on unsupported / unknown git provider.
	// For example: https://my-gitlab.com
	// If self-hosted instance of the supported git providers is used, then "git-provider" annotation must be set:
	// git-provider: gitlab
	EUnknownGitProvider BOErrorId = 60
	// Insecure HTTP can't be used for git repository URL
	EHttpUsedForRepository BOErrorId = 61

	// Happens when configured in cluster Pipelines as Code application is not installed in Component source repository.
	// User must install the application to fix this error.
	EGitHubAppNotInstalled BOErrorId = 70
	// Bad formatted private key
	EGitHubAppMalformedPrivateKey BOErrorId = 71
	// GitHub Application ID is not a valid integer
	EGitHubAppMalformedId BOErrorId = 77
	// Private key doesn't match the GitHub Application
	EGitHubAppPrivateKeyNotMatched BOErrorId = 72
	// GitHub Application with specified ID does not exists.
	// Correct configuration in the AppStudio installation ('pipelines-as-code-secret' secret in 'build-service' namespace).
	EGitHubAppDoesNotExist BOErrorId = 73
	// EGitHubAppSuspended Application in git repository is suspended
	EGitHubAppSuspended BOErrorId = 78

	// EGitHubTokenUnauthorized access token can't be recognized by GitHub and 401 is responded.
	// This error may be caused by a malformed token string or an expired token.
	EGitHubTokenUnauthorized BOErrorId = 74
	// EGitHubNoResourceToOperateOn No resource is suitable for GitHub to handle the request and 404 is responded.
	// Generally, this error could be caused by two cases. One is, operate non-existing resource with an access
	// token that has sufficient scope, e.g. delete a non-existing webhook. Another one is, the access token does
	// not have sufficient scope, e.g. list webhooks from a repository, but scope "read:repo_hook" is set.
	EGitHubNoResourceToOperateOn BOErrorId = 75
	// EGitHubReachRateLimit reach the GitHub REST API rate limit.
	EGitHubReachRateLimit BOErrorId = 76
	// EGitHubSecretInvalid the secret with GitHub App credentials is invalid.
	EGitHubSecretInvalid = 77
	// EGitHubSecretTypeNotSupported the secret type with GitHub App credentials is not supported.
	EGitHubSecretTypeNotSupported = 78

	// EGitLabTokenUnauthorized access token is not recognized by GitLab and 401 is responded.
	// The access token may be malformed or expired.
	EGitLabTokenUnauthorized BOErrorId = 90
	// EGitLabTokenInsufficientScope the access token does not have sufficient scope and 403 is responded.
	EGitLabTokenInsufficientScope BOErrorId = 91
	// EGitLabTokenBlockedAccount  access token has blocked account
	EGitLabTokenBlockedAccount BOErrorId = 92
	// EGitLabSecretTypeNotSupported the secret type with GitLab credentials is not supported.
	EGitLabSecretTypeNotSupported BOErrorId = 93

	// Value of 'image.redhat.com/image' component annotation is not a valid json or the json has invalid structure.
	EFailedToParseImageAnnotation BOErrorId = 200
	// The secret with git credentials specified in component.Spec.Secret does not exist in the user's namespace.
	EComponentGitSecretMissing BOErrorId = 201
	// The secret with image registry credentials specified in 'image.redhat.com/image' annotation does not exist in the user's namespace.
	EComponentImageRegistrySecretMissing BOErrorId = 202
	// The secret with git credentials not given for component with private git repository.
	EComponentGitSecretNotSpecified BOErrorId = 203
	// Value of 'build.appstudio.openshift.io/pipeline' component annotation is not a valid json or the json has invalid structure.
	EFailedToParsePipelineAnnotation BOErrorId = 204

	// EInvalidDevfile devfile of the component is not valid.
	EInvalidDevfile BOErrorId = 220

	// EUnsupportedPipelineRef The pipelineRef selected for a component
	EUnsupportedPipelineRef BOErrorId = 302
	// EMissingParamsForBundleResolver The pipelineRef selected for a component is missing parameters required for the bundle resolver.
	EMissingParamsForBundleResolver BOErrorId = 303
	// EWrongPipelineAnnotation Value of 'build.appstudio.openshift.io/pipeline' component annotation has wrong or missing values
	EWrongPipelineAnnotation BOErrorId = 304
	// EBuildPipelineConfigNotDefined build-pipeline-config configMap not found
	EBuildPipelineConfigNotDefined BOErrorId = 305
	// EBuildPipelineConfigNotValid build-pipeline-config configMap is not valid yaml
	EBuildPipelineConfigNotValid BOErrorId = 306
	// EBuildPipelineInvalid  pipeline in 'build.appstudio.openshift.io/pipeline' doesn't exist in build-pipeline-config configMap
	EBuildPipelineInvalid BOErrorId = 307
	// EMissingPipelineAnnotation 'build.appstudio.openshift.io/pipeline' component annotation is missing
	EMissingPipelineAnnotation BOErrorId = 308

	// EPipelineRetrievalFailed Failed to retrieve a Tekton Pipeline.
	EPipelineRetrievalFailed BOErrorId = 400
	// EPipelineConversionFailed Failed to convert a Tekton Pipeline to the version
	// that build-service supports (e.g. tekton.dev/v1beta1 -> tekton.dev/v1).
	EPipelineConversionFailed BOErrorId = 401
)

type BuildOpError

type BuildOpError struct {

	// Optional. To provide extra information about this error
	// If set, it will be appended to the error message returned from Error
	ExtraInfo string
	// contains filtered or unexported fields
}

BuildOpError extends standard error to:

  1. Keep persistent / transient property of the error. All errors, except ETransientErrorId considered persistent.
  2. Have error ID to show the root cause of the error and optionally short message.

func NewBuildOpError

func NewBuildOpError(id BOErrorId, err error) *BuildOpError

func (BuildOpError) Error

func (r BuildOpError) Error() string

func (BuildOpError) GetErrorId

func (r BuildOpError) GetErrorId() int

func (BuildOpError) IsPersistent

func (r BuildOpError) IsPersistent() bool

func (BuildOpError) ShortError

func (r BuildOpError) ShortError() string

ShortError returns short message with error ID in case of persistent error or standard error message for transient errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL