slackerror

package
v0.0.0-...-113aa42 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAccessDenied                                  = "access_denied"
	ErrAddAppToProject                               = "add_app_to_project_error"
	ErrAlreadyLoggedOut                              = "already_logged_out"
	ErrAlreadyResolved                               = "already_resolved"
	ErrAppsList                                      = "apps_list_error"
	ErrAppAdd                                        = "app_add_error"
	ErrAppApprovalRequestDenied                      = "app_approval_request_denied"
	ErrAppApprovalRequestEligible                    = "app_approval_request_eligible"
	ErrAppApprovalRequestPending                     = "app_approval_request_pending"
	ErrAppAuthTeamMismatch                           = "app_auth_team_mismatch"
	ErrAppCreate                                     = "app_create_error"
	ErrAppDelete                                     = "app_delete_error"
	ErrAppDeploy                                     = "app_deploy_error"
	ErrAppDeployNotSlackHosted                       = "app_deploy_function_runtime_not_slack"
	ErrAppDirectoryAccess                            = "app_directory_access_error"
	ErrAppDirOnlyFail                                = "app_dir_only_fail"
	ErrAppExists                                     = "app_add_exists"
	ErrAppFlagRequired                               = "app_flag_required"
	ErrAppFound                                      = "app_found"
	ErrAppHosted                                     = "app_hosted"
	ErrAppInstall                                    = "app_install_error"
	ErrAppManifestAccess                             = "app_manifest_access_error"
	ErrAppManifestCreate                             = "app_manifest_create_error"
	ErrAppManifestGenerate                           = "app_manifest_generate_error"
	ErrAppManifestUpdate                             = "app_manifest_update_error"
	ErrAppManifestValidate                           = "app_manifest_validate_error"
	ErrAppNotEligible                                = "app_not_eligible"
	ErrAppNotInstalled                               = "app_not_installed"
	ErrAppNotFound                                   = "app_not_found"
	ErrAppNotHosted                                  = "app_not_hosted"
	ErrAppRemove                                     = "app_remove_error"
	ErrAppRenameApp                                  = "app_rename_app"
	ErrAuthProdTokenNotFound                         = "auth_prod_token_not_found"
	ErrAuthTimeout                                   = "auth_timeout_error"
	ErrAuthToken                                     = "auth_token_error"
	ErrAuthVerification                              = "auth_verification_error"
	ErrBotInviteRequired                             = "bot_invite_required" // Slack API error code
	ErrCannotAbandonApp                              = "cannot_abandon_app"
	ErrCannotAddOwner                                = "cannot_add_owner"
	ErrCannotCountOwners                             = "cannot_count_owners"
	ErrCannotDeleteApp                               = "cannot_delete_app"
	ErrCannotListCollaborators                       = "cannot_list_collaborators"
	ErrCannotListOwners                              = "cannot_list_owners"
	ErrCannotRemoveCollaborators                     = "cannot_remove_collaborators"
	ErrCannotRemoveOwners                            = "cannot_remove_owner"
	ErrCannotRevokeOrgBotToken                       = "cannot_revoke_org_bot_token"
	ErrConnectorApprovalPending                      = "connector_approval_pending"
	ErrConnectorApprovalRequired                     = "connector_approval_required"
	ErrConnectorDenied                               = "connector_denied"
	ErrConnectorNotInstalled                         = "connector_not_installed"
	ErrChannelNotFound                               = "channel_not_found"
	ErrCLIAutoUpdate                                 = "cli_autoupdate_error"
	ErrCLIConfigLocationError                        = "cli_config_location_error"
	ErrCLIConfigInvalid                              = "cli_config_invalid"
	ErrCLIReadError                                  = "cli_read_error"
	ErrCLIUpdateRequired                             = "cli_update_required" // Slack API error code
	ErrCommentRequired                               = "comment_required"
	ErrConnectedOrgDenied                            = "connected_org_denied"
	ErrConnectedTeamDenied                           = "connected_team_denied"
	ErrContextValueNotFound                          = "context_value_not_found"
	ErrCredentialsNotFound                           = "credentials_not_found"
	ErrCustomizableInputMissingMatchingWorkflowInput = "customizable_input_missing_matching_workflow_input"
	ErrCustomizableInputsNotAllowedOnOptionalInputs  = "customizable_inputs_not_allowed_on_optional_inputs"
	ErrCustomizableInputsOnlyAllowedOnLinkTriggers   = "customizable_inputs_only_allowed_on_link_triggers"
	ErrCustomizableInputUnsupportedType              = "customizable_input_unsupported_type"
	ErrDatastore                                     = "datastore_error"
	ErrDatastoreMissingPrimaryKey                    = "datastore_missing_primary_key"
	ErrDatastoreNotFound                             = "datastore_not_found"
	ErrDefaultAppAccess                              = "default_app_access_error"
	ErrDefaultAppSetting                             = "default_app_setting_error"
	ErrDenoNotFound                                  = "deno_not_found"
	ErrDeployedAppNotSupported                       = "deployed_app_not_supported"
	ErrDocumentationGenerationFailed                 = "documentation_generation_failed"
	ErrEnterpriseNotFound                            = "enterprise_not_found"
	ErrFailedAddingCollaborator                      = "failed_adding_collaborator"
	ErrFailedCreatingApp                             = "failed_creating_app"
	ErrFailedDatastoreOperation                      = "failed_datastore_operation"
	ErrFailedExport                                  = "failed_export"
	ErrFailForSomeRequests                           = "failed_for_some_requests"
	ErrFailedToGetUser                               = "failed_to_get_user"
	ErrFailedToSaveExtensionLogs                     = "failed_to_save_extension_logs"
	ErrFailToGetTeamsForRestrictedUser               = "fail_to_get_teams_for_restricted_user"
	ErrFeedbackNameInvalid                           = "feedback_name_invalid"
	ErrFeedbackNameRequired                          = "feedback_name_required"
	ErrFileRejected                                  = "file_rejected"
	ErrForbiddenTeam                                 = "forbidden_team"
	ErrFreeTeamNotAllowed                            = "free_team_not_allowed"
	ErrFunctionBelongsToAnotherApp                   = "function_belongs_to_another_app"
	ErrFunctionNotFound                              = "function_not_found"
	ErrGitNotFound                                   = "git_not_found"
	ErrGitClone                                      = "git_clone_error"
	ErrGitZipDownload                                = "git_zip_download_error"
	ErrHomeDirectoryAccessFailed                     = "home_directory_access_failed"
	ErrHooksJSONLocation                             = "hooks_json_location_error"
	ErrHostAppsDisallowUserScopes                    = "hosted_apps_disallow_user_scopes"
	ErrHTTPRequestFailed                             = "http_request_failed"
	ErrHTTPResponseInvalid                           = "http_response_invalid"
	ErrInsecureRequest                               = "insecure_request"
	ErrInstallationDenied                            = "installation_denied"
	ErrInstallationFailed                            = "installation_failed"
	ErrInstallationRequired                          = "installation_required"
	ErrInternal                                      = "internal_error"
	ErrInvalidApp                                    = "invalid_app"
	ErrInvalidAppDirectory                           = "invalid_app_directory"
	ErrInvalidAppFlag                                = "invalid_app_flag"
	ErrInvalidAppID                                  = "invalid_app_id"
	ErrInvalidArgs                                   = "invalid_args"
	ErrInvalidArgumentsCustomizableInputs            = "invalid_arguments_customizable_inputs"
	ErrInvalidArguments                              = "invalid_arguments"
	ErrInvalidAuth                                   = "invalid_auth"
	ErrInvalidChallenge                              = "invalid_challenge"
	ErrInvalidChannelID                              = "invalid_channel_id"
	ErrInvalidCursor                                 = "invalid_cursor"
	ErrInvalidDistributionType                       = "invalid_distribution_type"
	ErrInvalidFlag                                   = "invalid_flag"
	ErrInvalidInteractiveTriggerInputs               = "invalid_interactive_trigger_inputs"
	ErrInvalidManifest                               = "invalid_manifest"
	ErrInvalidManifestSource                         = "invalid_manifest_source"
	ErrInvalidParameters                             = "invalid_parameters"
	ErrInvalidPermissionType                         = "invalid_permission_type"
	ErrInvalidRefreshToken                           = "invalid_refresh_token"
	ErrInvalidRequestID                              = "invalid_request_id"
	ErrInvalidResourceID                             = "invalid_resource_id"
	ErrInvalidResourceType                           = "invalid_resource_type"
	ErrInvalidS3Key                                  = "invalid_s3_key"
	ErrInvalidScopes                                 = "invalid_scopes"
	ErrInvalidSemVer                                 = "invalid_semver"
	ErrInvalidSlackProjectDirectory                  = "invalid_slack_project_directory"
	ErrInvalidDatastore                              = "invalid_datastore"
	ErrInvalidDatastoreExpression                    = "invalid_datastore_expression"
	ErrInvalidToken                                  = "invalid_token"
	ErrInvalidTrigger                                = "invalid_trigger"
	ErrInvalidTriggerAccess                          = "invalid_trigger_access"
	ErrInvalidTriggerConfig                          = "invalid_trigger_config"
	ErrInvalidTriggerEventType                       = "invalid_trigger_event_type"
	ErrInvalidTriggerInputs                          = "invalid_trigger_inputs"
	ErrInvalidTriggerType                            = "invalid_trigger_type"
	ErrInvalidUserID                                 = "invalid_user_id"
	ErrInvalidWebhookConfig                          = "invalid_webhook_config"
	ErrInvalidWebhookSchemaRef                       = "invalid_webhook_schema_ref"
	ErrInvalidWorkflowAppID                          = "invalid_workflow_app_id"
	ErrInvalidWorkflowID                             = "invalid_workflow_id"
	ErrIsRestricted                                  = "is_restricted"
	ErrLocalAppNotFound                              = "local_app_not_found"
	ErrLocalAppNotSupported                          = "local_app_not_supported"
	ErrLocalAppRemoval                               = "local_app_removal_error"
	ErrLocalAppRun                                   = "local_app_run_error"
	ErrLocalAppRunCleanExit                          = "local_app_run_clean_exit"
	ErrMethodNotSupported                            = "method_not_supported"
	ErrMismatchedFlags                               = "mismatched_flags"
	ErrMissingAppID                                  = "missing_app_id"
	ErrMissingAppTeamID                              = "missing_app_team_id"
	ErrMissingChallenge                              = "missing_challenge"
	ErrMissingExperiment                             = "missing_experiment"
	ErrMissingFunctionIdentifier                     = "missing_function_identifier"
	ErrMissingFlag                                   = "missing_flag"
	ErrMissingInput                                  = "missing_input"
	ErrMissingOptions                                = "missing_options"
	ErrMissingScope                                  = "missing_scope"
	ErrMissingScopes                                 = "missing_scopes"
	ErrMissingUser                                   = "missing_user"
	ErrMissingValue                                  = "missing_value"
	ErrNotAuthed                                     = "not_authed"
	ErrNotBearerToken                                = "not_bearer_token"
	ErrNotFound                                      = "not_found"
	ErrNoFile                                        = "no_file"
	ErrNoPendingRequest                              = "no_pending_request"
	ErrNoPermission                                  = "no_permission"
	ErrNoTokenFound                                  = "no_token_found"
	ErrNoTriggers                                    = "no_triggers"
	ErrNoValidNamedEntities                          = "no_valid_named_entities"
	ErrOrgNotConnected                               = "org_not_connected"
	ErrOrgNotFound                                   = "org_not_found"
	ErrOrgGrantExists                                = "org_grant_exists"
	ErrOSNotSupported                                = "os_not_supported"
	ErrOverResourceLimit                             = "over_resource_limit"
	ErrParameterValidationFailed                     = "parameter_validation_failed"
	ErrProcessInterrupted                            = "process_interrupted"
	ErrProjectCompilation                            = "project_compilation_error"
	ErrProjectConfigIDNotFound                       = "project_config_id_not_found"
	ErrProjectConfigManifestSource                   = "project_config_manifest_source_error"
	ErrProjectFileUpdate                             = "project_file_update_error"
	ErrProviderNotFound                              = "provider_not_found"
	ErrPrompt                                        = "prompt_error"
	ErrPublishedAppOnly                              = "published_app_only"
	ErrRequestIDOrAppIDIsRequired                    = "request_id_or_app_id_is_required"
	ErrRatelimited                                   = "ratelimited"
	ErrRestrictedPlanLevel                           = "restricted_plan_level"
	ErrRuntimeNotFound                               = "runtime_not_found"
	ErrRuntimeNotSupported                           = "runtime_not_supported"
	ErrSDKConfigLoad                                 = "sdk_config_load_error"
	ErrSDKHookInvocationFailed                       = "sdk_hook_invocation_failed"
	ErrSDKHookNotFound                               = "sdk_hook_not_found"
	ErrSampleCreate                                  = "sample_create_error"
	ErrServiceLimitsExceeded                         = "service_limits_exceeded"
	ErrSharedChannelDenied                           = "shared_channel_denied"
	ErrSlackAuth                                     = "slack_auth_error"
	ErrSlackJSONLocation                             = "slack_json_location_error"
	ErrSlackSlackJSONLocation                        = "slack_slack_json_location_error"
	ErrSocketConnection                              = "socket_connection_error"
	ErrScopesExceedAppConfig                         = "scopes_exceed_app_config"
	ErrStreamingActivityLogs                         = "streaming_activity_logs_error"
	ErrSurveyConfigNotFound                          = "survey_config_not_found"
	ErrSystemConfigIDNotFound                        = "system_config_id_not_found"
	ErrSystemRequirementsFailed                      = "system_requirements_failed"
	ErrTeamAccessNotGranted                          = "team_access_not_granted"
	ErrTeamFlagRequired                              = "team_flag_required"
	ErrTeamList                                      = "team_list_error"
	ErrTeamNotConnected                              = "team_not_connected"
	ErrTeamNotFound                                  = "team_not_found"
	ErrTeamNotOnEnterprise                           = "team_not_on_enterprise"
	ErrTeamQuotaExceeded                             = "team_quota_exceeded"
	ErrTemplatePathNotFound                          = "template_path_not_found"
	ErrTokenExpired                                  = "token_expired"
	ErrTokenRevoked                                  = "token_revoked"
	ErrTokenRotation                                 = "token_rotation_error"
	ErrTooManyCustomizableInputs                     = "too_many_customizable_inputs"
	ErrTooManyIdsProvided                            = "too_many_ids_provided"
	ErrTooManyNamedEntities                          = "too_many_named_entities"
	ErrTriggerCreate                                 = "trigger_create_error"
	ErrTriggerDelete                                 = "trigger_delete_error"
	ErrTriggerDoesNotExist                           = "trigger_does_not_exist"
	ErrTriggerNotFound                               = "trigger_not_found"
	ErrTriggerUpdate                                 = "trigger_update_error"
	ErrUnableToDelete                                = "unable_to_delete"
	ErrUnableToOpenFile                              = "unable_to_open_file"
	ErrUnableToParseJSON                             = "unable_to_parse_json"
	ErrUninstallHalted                               = "uninstall_halted"
	ErrUnknownFileType                               = "unknown_file_type"
	ErrUnknownFunctionID                             = "unknown_function_id"
	ErrUnknownMethod                                 = "unknown_method"
	ErrUnknownWebhookSchemaRef                       = "unknown_webhook_schema_ref"
	ErrUnknownWorkflowID                             = "unknown_workflow_id"
	ErrUntrustedSource                               = "untrusted_source"
	ErrUnsupportedFileName                           = "unsupported_file_name"
	ErrUserAlreadyOwner                              = "user_already_owner"
	ErrUserAlreadyRequested                          = "user_already_requested"
	ErrUserCannotManageApp                           = "user_cannot_manage_app"
	ErrUserIDIsRequired                              = "user_id_is_required"
	ErrUserNotFound                                  = "user_not_found"
	ErrUserRemovedFromTeam                           = "user_removed_from_team"
	ErrWorkflowNotFound                              = "workflow_not_found"
	ErrYaml                                          = "yaml_error"
)
View Source
const MaxRecursiveErrDepth = 20

Variables

View Source
var ErrorCodeMap = map[string]Error{}/* 242 elements not displayed */
View Source
var ErrorMessageMap = errorMessageMap()

Functions

func Is

func Is(err error, errorCode string) bool

Is checks if errorCode is the code for an error, err

func IsErrorType

func IsErrorType(err error, code string) bool

IsErrorType returns true if the given error is of the type represented by the given error code

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf returns an error annotating err with a stack trace at the point Wrapf is called, and the format specifier. If err is nil, Wrapf returns nil.

Types

type Error

type Error struct {
	Code        string       `json:"code,omitempty"`
	Message     string       `json:"error,omitempty"`
	Description string       `json:"slack_cli_error_description,omitempty"`
	Remediation string       `json:"remediation,omitempty"`
	Details     ErrorDetails `json:"errors,omitempty"`
	Cause       error        // TODO - Refactor 'Cause' to be 'Error' so that native Go error unwrapping works with a slackerror

	// useful for api errors
	APIEndpoint string
}

A custom Error for the Slack CLI and API errors

func JSONUnmarshalError

func JSONUnmarshalError(err error, data []byte) *Error

JSONUnmarshalError returns a human readable json unmarshal error for CLI users Simply displaying the json.Unmarshal errors have proven to be very confusing already. This attempts to ensure the user understands that the CLI is trying to parse a JSON but is running into some issues.

func New

func New(msgOrCode string) *Error

New returns an Error struct. It first searches our known errors based on the error message to find it. If the error exists it returns the known error struct. Otherwise it creates a new Error and returns that.

func NewAPIError

func NewAPIError(errorCode string, description string, details ErrorDetails, apiEndpoint string) *Error

NewAPIError returns an API error with details and error code

func ToSlackError

func ToSlackError(err error) *Error

ToSlackError will cast an error to our custom Error type

func Wrap

func Wrap(cause error, message string) *Error

Wrap returns an error and the supplied message. If err is nil, Wrap returns a new error. Wrap returns a new error with message and the cause as err.

func (*Error) AddAPIMethod

func (e *Error) AddAPIMethod(endpoint string) *Error

AddAPIMethod will set the api endpoint for a slack error It is useful for rendering API errors

func (*Error) AddDetail

func (e *Error) AddDetail(detail ErrorDetail) *Error

AddDetail will add an error detail to a slack error

func (*Error) AppendMessage

func (e *Error) AppendMessage(message string) *Error

AppendMessage will append to the error Message if one exists already If none exists, it will set message as the error Message

func (*Error) AppendRemediation

func (e *Error) AppendRemediation(remediationMsg string) *Error

AppendRemediation will append to the Remediation if one exists already If none exists, it will set remediationMsg as the error's Remidiation

func (*Error) Error

func (e *Error) Error() string

Error stringifies the custom Error struct

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap will return the imminent root cause of an error

func (*Error) WithCode

func (e *Error) WithCode(code string) *Error

WithCode will set the error code for a slack error

func (*Error) WithDetails

func (e *Error) WithDetails(details ErrorDetails) *Error

WithDetails will set the error details for a slack error

func (*Error) WithMessage

func (e *Error) WithMessage(msg string, args ...interface{}) *Error

WithMessage will set the error message for a slack error

func (*Error) WithRemediation

func (e *Error) WithRemediation(remediationMsg string, args ...interface{}) *Error

WithRemediation will set the remediation text for a slack error

func (*Error) WithRootCause

func (e *Error) WithRootCause(err error) *Error

WithRootCause will add err as part of the error details of this error.

type ErrorDetail

type ErrorDetail struct {
	Code             string                 `json:"code,omitempty"`
	Constraint       constraint             `json:"constraint,omitempty"`
	Message          string                 `json:"message,omitempty"`
	Pointer          string                 `json:"pointer,omitempty"`
	Remediation      string                 `json:"remediation,omitempty"`
	RelatedComponent string                 `json:"related_component,omitempty"`
	Item             map[string]interface{} `json:"item,omitempty"`
}

type ErrorDetails

type ErrorDetails []ErrorDetail

type Warning

type Warning struct {
	Code        string `json:"code,omitempty"`
	Message     string `json:"message,omitempty"`
	Remediation string `json:"remediation,omitempty"`
	Pointer     string `json:"pointer,omitempty"`
}

Warning contains structured warning information

type Warnings

type Warnings []Warning

Warnings holds information from multiple warning

func (Warnings) Warning

func (warn Warnings) Warning(verbose bool, message string) string

Warning formats the custom Warnings array with a message

Jump to

Keyboard shortcuts

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