errors

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorAPIUnavailable = &CLIError{
	Title:      "Major API unavailable",
	Suggestion: "Major services are currently unavailable. Please try again later.",
	Err:        errors.New("API unavailable"),
}
View Source
var ErrorApplicationDescriptionRequired = &CLIError{
	Title:      "Application description required",
	Suggestion: "Please enter a description for your application.",
	Err:        errors.New("application description required"),
}
View Source
var ErrorApplicationNameRequired = &CLIError{
	Title:      "Application name required",
	Suggestion: "Please enter a name for your application.",
	Err:        errors.New("application name required"),
}
View Source
var ErrorApplicationNotFound = &CLIError{
	Title:      "Application not found",
	Suggestion: "The application does not exist or you don't have access to it.",
	Err:        errors.New("application not found"),
}

Application Errors

View Source
var ErrorApplicationNotFoundAPI = &CLIError{
	Title:      "Application not found",
	Suggestion: "The application does not exist or you don't have access to it.",
	Err:        errors.New("application not found"),
}

API Error Codes - Application (4000-4099)

View Source
var ErrorAuthenticationFailed = &CLIError{
	Title:      "Authentication failed",
	Suggestion: "Run 'major user login' to authenticate",
	Err:        errors.New("authentication failed"),
}
View Source
var ErrorAuthorizationPending = &CLIError{
	Title:      "Authorization pending",
	Suggestion: "Please complete the login process in your browser.",
	Err:        errors.New("authorization pending"),
}
View Source
var ErrorConfigNotFound = &CLIError{
	Title:      "Configuration not found",
	Suggestion: "Unable to load CLI configuration. Please reinstall the CLI.",
	Err:        errors.New("configuration file not found"),
}

Configuration Errors

View Source
var ErrorDuplicateAppName = &CLIError{
	Title:      "Application name already exists",
	Suggestion: "An application with this name already exists. Please choose a different name.",
	Err:        errors.New("duplicate application name"),
}
View Source
var ErrorFailedToSelectResources = &CLIError{
	Title:      "Failed to select resources",
	Suggestion: "Please run 'major app resources' to select resources later.",
	Err:        errors.New("failed to select resources"),
}
View Source
var ErrorFailedToSelectResourcesTryAgain = &CLIError{
	Title:      "Failed to select resources",
	Suggestion: "We're not sure what went wrong. Please try again! Contact support if the problem persists.",
	Err:        errors.New("failed to select resources"),
}
View Source
var ErrorForceUpgrade = &CLIError{
	Title:      "Your CLI version is out of date and must be upgraded.",
	Suggestion: "Run: major update",
	Err:        errors.New("CLI version is out of date and must be upgraded"),
}
View Source
var ErrorGitCloneFailed = &CLIError{
	Title:      "Failed to clone repository",
	Suggestion: "Please check your SSH keys are configured correctly. Run 'ssh -T git@github.com' to test your GitHub SSH connection.",
	Err:        errors.New("failed to clone repository"),
}
View Source
var ErrorGitHubCollaboratorAddFailed = &CLIError{
	Title:      "Failed to add GitHub collaborator",
	Suggestion: "Unable to add collaborator to the GitHub repository. Please check your permissions.",
	Err:        errors.New("github collaborator add failed"),
}
View Source
var ErrorGitHubRepoAccessDenied = &CLIError{
	Title:      "GitHub repository access denied",
	Suggestion: "Unable to access the GitHub repository. Please check your permissions.",
	Err:        errors.New("github repository access denied"),
}
View Source
var ErrorGitHubRepoNotFound = &CLIError{
	Title:      "GitHub repository not found",
	Suggestion: "Most likely, this is not a major application repository. \n\nYou can create a new application with 'major app create' or clone an existing application with 'major app clone'.",
	Err:        errors.New("github repository not found"),
}

API Error Codes - GitHub Integration (5000-5099)

View Source
var ErrorGitNotFound = &CLIError{
	Title:      "Git not found",
	Suggestion: "Git is required. Please install it from https://git-scm.com",
	Err:        errors.New("git not found in PATH"),
}

Git Errors

View Source
var ErrorGitRepositoryAccessFailed = &CLIError{
	Title:      "Failed to access repository after accepting invitation",
	Suggestion: "Please check your SSH keys are configured correctly. Run 'ssh -T git@github.com' to test your GitHub SSH connection.",
	Err:        errors.New("failed to access repository after accepting invitation"),
}
View Source
var ErrorInvalidConfig = &CLIError{
	Title:      "Invalid configuration",
	Suggestion: "CLI configuration is invalid. Please reinstall the CLI.",
	Err:        errors.New("invalid configuration format"),
}
View Source
var ErrorInvalidDeviceCode = &CLIError{
	Title:      "Invalid device code",
	Suggestion: "The device code is invalid. Please try logging in again.",
	Err:        errors.New("invalid device code"),
}
View Source
var ErrorInvalidInput = &CLIError{
	Title:      "Invalid input",
	Suggestion: "Please check your input and try again.",
	Err:        errors.New("invalid input"),
}

General Errors

View Source
var ErrorInvalidToken = &CLIError{
	Title:      "Your session has expired!",
	Suggestion: "Run 'major user login' to login again.",
	Err:        errors.New("invalid or expired token"),
}
View Source
var ErrorInvalidUserCode = &CLIError{
	Title:      "Invalid user code",
	Suggestion: "The user code you entered is invalid. Please try logging in again.",
	Err:        errors.New("invalid user code"),
}
View Source
var ErrorNetworkFailure = &CLIError{
	Title:      "Network error",
	Suggestion: "Unable to connect to Major services. Please check your internet connection.",
	Err:        errors.New("network failure"),
}

Network/API Errors

View Source
var ErrorNoApplicationAccess = &CLIError{
	Title:      "No application access",
	Suggestion: "You don't have permission to access this application.",
	Err:        errors.New("no application access"),
}
View Source
var ErrorNoApplicationContext = &CLIError{
	Title:      "No application context",
	Suggestion: "Run this command from within an application directory, or specify an application.",
	Err:        errors.New("no application context"),
}
View Source
var ErrorNoApplicationsAvailable = &CLIError{
	Title:      "No applications available for this organization",
	Suggestion: "Create an application first with 'major app create'",
	Err:        errors.New("no applications available"),
}
View Source
var ErrorNoCreatePermission = &CLIError{
	Title:      "No permission to create",
	Suggestion: "You don't have permission to create resources in this organization.",
	Err:        errors.New("no create permission"),
}
View Source
var ErrorNoGitRemoteFoundInDirectory = &CLIError{
	Title:      "No git remote found in directory",
	Suggestion: "Please make sure you are in a git repository and have a remote origin set.",
	Err:        errors.New("no git remote found in directory"),
}
View Source
var ErrorNoOrganizationSelected = &CLIError{
	Title:      "No organization selected",
	Suggestion: "Run 'major org select' to choose an organization.",
	Err:        errors.New("no organization selected"),
}

Organization Errors

View Source
var ErrorNoOrganizationsAvailable = &CLIError{
	Title:      "No organizations available",
	Suggestion: "Please create one on https://app.major.build. Then run `major org select` to select it.",
	Err:        errors.New("no organizations available"),
}
View Source
var ErrorNoResourcesAvailable = &CLIError{
	Title:      "No resources available",
	Suggestion: "No resources are available for your organization.",
	Err:        errors.New("no resources available"),
}

Resource Errors

View Source
var ErrorNoValidCloneMethodAvailable = &CLIError{
	Title:      "No valid clone method available",
	Suggestion: "Please check your SSH keys are configured correctly. Run 'ssh -T git@github.com' to test your GitHub SSH connection.",
	Err:        errors.New("no valid clone method available"),
}
View Source
var ErrorNodeNotFound = &CLIError{
	Title:      "Node.js not found",
	Suggestion: "Node.js is required. Please install it from https://nodejs.org",
	Err:        errors.New("node not found in PATH"),
}
View Source
var ErrorNotGitRepository = &CLIError{
	Title:      "Not a major repository",
	Suggestion: "Make sure you're inside a major project directory.",
	Err:        errors.New("not a git repository"),
}
View Source
var ErrorNotInGitRepository = &CLIError{
	Title:      "Not in a git repository",
	Suggestion: "You probably need to cd into your application directory first.",
	Err:        errors.New("not in a git repository"),
}
View Source
var ErrorNotLoggedIn = &CLIError{
	Title:      "Not logged in!",
	Suggestion: "Run 'major user login' to get started.",
	Err:        errors.New("user not logged in"),
}

Authentication/Session Errors

View Source
var ErrorNotOrgMember = &CLIError{
	Title:      "Not an organization member",
	Suggestion: "You are not a member of this organization. Please contact an admin.",
	Err:        errors.New("not an organization member"),
}
View Source
var ErrorOldProjectNotSupported = &CLIError{
	Title:      "Old project not supported",
	Suggestion: "This project is not supported. Please create a new project with 'major app create'.",
	Err:        errors.New("old project not supported"),
}
View Source
var ErrorOperationCancelled = &CLIError{
	Title:      "Operation cancelled",
	Suggestion: "",
	Err:        errors.New("operation cancelled by user"),
}
View Source
var ErrorOrganizationNotFound = &CLIError{
	Title:      "Organization not found",
	Suggestion: "The organization does not exist or you don't have access to it.",
	Err:        errors.New("organization not found"),
}
View Source
var ErrorOrganizationNotFoundAPI = &CLIError{
	Title:      "Organization not found",
	Suggestion: "The organization does not exist or you don't have access to it.",
	Err:        errors.New("organization not found"),
}

API Error Codes - Organization (3000-3099)

View Source
var ErrorPnpmNotFound = &CLIError{
	Title:      "pnpm not found",
	Suggestion: "pnpm is required. Install it with: brew install pnpm\nOr if you have Node.js: corepack enable",
	Err:        errors.New("pnpm not found in PATH"),
}

Dependency/Tool Errors

View Source
var ErrorRepositoryAccessTimeout = &CLIError{
	Title:      "Timeout waiting for repository access",
	Suggestion: "Please try again after accepting the invitation.",
	Err:        errors.New("timeout waiting for repository access"),
}
View Source
var ErrorResourceNotFound = &CLIError{
	Title:      "Resource not found",
	Suggestion: "The requested resource does not exist.",
	Err:        errors.New("resource not found"),
}
View Source
var ErrorSessionExpired = &CLIError{
	Title:      "Your session has expired!",
	Suggestion: "Run 'major user login' to login again.",
	Err:        errors.New("session expired"),
}
View Source
var ErrorTokenNotActive = &CLIError{
	Title:      "Token not active",
	Suggestion: "Please run major user login to login again.",
	Err:        errors.New("token not active"),
}
View Source
var ErrorTokenNotFound = &CLIError{
	Title:      "Not logged in!",
	Suggestion: "Run 'major user login' to get started.",
	Err:        errors.New("no authentication token found"),
}
View Source
var ErrorUnauthorized = &CLIError{
	Title:      "Unauthorized",
	Suggestion: "You don't have permission to perform this action. Try running 'major user login' again.",
	Err:        errors.New("unauthorized"),
}

API Error Codes - Authentication & Authorization (2000-2099)

View Source
var ErrorUnsupportedGitRemoteURL = &CLIError{
	Title:      "Unsupported git remote URL format",
	Suggestion: "Only GitHub SSH (git@github.com:owner/repo.git) and HTTPS (https://github.com/owner/repo.git) URLs are supported.",
	Err:        errors.New("unsupported git remote URL format"),
}

Functions

func PrintError

func PrintError(cmd *cobra.Command, err error)

Types

type CLIError

type CLIError struct {
	Title      string
	Suggestion string
	Err        error
}

CLIError represents a user-facing CLI error with a title, suggestion, and underlying error

func ErrorNodeVersionTooOld

func ErrorNodeVersionTooOld(required, current string) *CLIError

func ErrorUnsupportedGitRemoteURLWithFormat

func ErrorUnsupportedGitRemoteURLWithFormat(url string) *CLIError

func WrapError

func WrapError(msg string, ogerr error) *CLIError

WrapError wraps an existing error with additional context using Standard Lib

func (*CLIError) Error

func (e *CLIError) Error() string

Standard error interface

func (*CLIError) Unwrap

func (e *CLIError) Unwrap() error

Unwrap allows standard errors.Is/As to work on this struct

Jump to

Keyboard shortcuts

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