Module: Vagrant::Errors

Defined in:
lib/vagrant/errors.rb

Overview

This module contains all of the internal errors in Vagrant's core. These errors are expected errors and as such don't typically represent bugs in Vagrant itself. These are meant as a way to detect errors and display them in a user-friendly way.

Defining a new Error

To define a new error, inherit from VagrantError, which lets Vagrant know that this is an expected error, and also gives you some helpers for providing exit codes and error messages. An example is shown below, then it is explained:

class MyError < Vagrant::Errors::VagrantError
  error_key "my_error"
end

This creates an error with an I18n error key of "my_error." VagrantError uses I18n to look up error messages, in the "vagrant.errors" namespace. So in the above, the error message would be the translation of "vagrant.errors.my_error"

If you don't want to use I18n, you can override the #initialize method and set your own error message.

Raising an Error

To raise an error, it is nothing special, just raise it like any normal exception:

raise MyError.new

Eventually this exception will bubble out to the vagrant binary which will show a nice error message. And if it is raised in the middle of a middleware sequence, then Action::Warden will catch it and begin the recovery process prior to exiting.

Defined Under Namespace

Classes: ActiveMachineWithDifferentProvider, AliasInvalidError, BatchMultiError, BoxAddDirectVersion, BoxAddMetadataMultiURL, BoxAddNameMismatch, BoxAddNameRequired, BoxAddNoMatchingProvider, BoxAddNoMatchingVersion, BoxAddShortNotFound, BoxAlreadyExists, BoxChecksumInvalidType, BoxChecksumMismatch, BoxConfigChangingBox, BoxFileNotExist, BoxMetadataCorrupted, BoxMetadataDownloadError, BoxMetadataFileNotFound, BoxMetadataMalformed, BoxMetadataMalformedVersion, BoxMetadataMissingRequiredFields, BoxNotFound, BoxNotFoundWithProvider, BoxNotFoundWithProviderAndVersion, BoxNotFoundWithProviderArchitecture, BoxProviderDoesntMatch, BoxRemoveArchitectureNotFound, BoxRemoveMultiArchitecture, BoxRemoveMultiProvider, BoxRemoveMultiVersion, BoxRemoveNotFound, BoxRemoveProviderNotFound, BoxRemoveVersionNotFound, BoxServerNotSet, BoxUnpackageFailure, BoxUpdateMultiArchitecture, BoxUpdateMultiProvider, BoxUpdateNoMetadata, BoxVerificationFailed, BoxVersionInvalid, BundlerDisabled, BundlerError, CFEngineBootstrapFailed, CFEngineCantAutodetectIP, CFEngineInstallFailed, CFEngineNotInstalled, CLIInvalidOptions, CLIInvalidUsage, CantReadMACAddresses, CapabilityHostExplicitNotDetected, CapabilityHostNotDetected, CapabilityInvalid, CapabilityNotFound, CloneMachineNotFound, CloneNotFound, CloudInitCommandFailed, CloudInitNotFound, CommandDeprecated, CommandSuspendAllArgs, CommandUnavailable, CommandUnavailableWindows, CommunicatorNotFound, ConfigInvalid, ConfigUpgradeErrors, CopyPrivateKeyFailed, CorruptMachineIndex, CreateIsoHostCapNotFound, DarwinMountFailed, DarwinVersionFailed, DestroyRequiresForce, DotfileUpgradeJSONError, DownloadAlreadyInProgress, DownloaderChecksumError, DownloaderError, DownloaderInterrupted, EnvInval, EnvironmentLockedError, EnvironmentNonExistentCWD, ForwardPortAdapterNotFound, ForwardPortAutolistEmpty, ForwardPortCollision, ForwardPortHostIPNotFound, GuestCapabilityInvalid, GuestCapabilityNotFound, GuestExplicitNotDetected, GuestNotDetected, HomeDirectoryLaterVersion, HomeDirectoryNotAccessible, HomeDirectoryUnknownVersion, HostExplicitNotDetected, HypervVirtualBoxError, ISOBuildFailed, LinuxMountFailed, LinuxRDPClientNotFound, LocalDataDirectoryNotAccessible, MachineActionLockedError, MachineFolderNotAccessible, MachineGuestNotReady, MachineLocked, MachineNotFound, MachineStateInvalid, MultiVMTargetRequired, NFSBadExports, NFSCantReadExports, NFSClientNotInstalledInGuest, NFSDupePerms, NFSExportsFailed, NFSMountFailed, NFSNoGuestIP, NFSNoHostIP, NFSNoHostonlyNetwork, NFSNoValidIds, NFSNotSupported, NetSSHException, NetplanNoAvailableRenderers, NetworkAddressInvalid, NetworkCollision, NetworkDHCPAlreadyAttached, NetworkManagerNotInstalled, NetworkNotFound, NetworkTypeNotSupported, NoDefaultProvider, NoDefaultSyncedFolderImpl, NoEnvironmentError, PackageIncludeMissing, PackageIncludeSymlink, PackageInvalidInfo, PackageOutputDirectory, PackageOutputExists, PackageRequiresDirectory, PluginGemNotFound, PluginInitError, PluginInstallFailed, PluginInstallLicenseNotFound, PluginInstallSpace, PluginInstallVersionConflict, PluginLoadError, PluginMissingLibrary, PluginMissingLocalError, PluginMissingRubyDev, PluginNeedsDeveloperTools, PluginNoLocalError, PluginNotInstalled, PluginSourceError, PluginStateFileParseError, PluginUninstallSystem, PowerShellError, PowerShellInvalidVersion, PowerShellNotFound, ProviderCantInstall, ProviderChecksumMismatch, ProviderInstallFailed, ProviderNotFound, ProviderNotFoundSuggestion, ProviderNotUsable, ProvisionerFlagInvalid, ProvisionerWinRMUnsupported, PushStrategyNotDefined, PushStrategyNotLoaded, PushStrategyNotProvided, PushesNotDefined, RSyncError, RSyncGuestInstallError, RSyncNotFound, RSyncNotInstalledInGuest, RSyncPostCommandError, SCPPermissionDenied, SCPUnavailable, SSHAuthenticationFailed, SSHChannelOpenFail, SSHConnectEACCES, SSHConnectionAborted, SSHConnectionRefused, SSHConnectionReset, SSHConnectionTimeout, SSHDisconnected, SSHHostDown, SSHInsertKeyUnsupported, SSHInvalidShell, SSHIsPuttyLink, SSHKeyBadOwner, SSHKeyBadPermissions, SSHKeyTypeNotSupported, SSHNoExitStatus, SSHNoRoute, SSHNotReady, SSHRunRequiresKeys, SSHUnavailable, SSHUnavailableWindows, SharedFolderCreateFailed, ShellExpandFailed, SnapshotConflictFailed, SnapshotNotFound, SnapshotNotSupported, SourceSpecNotFound, SyncedFolderUnusable, TriggersBadExitCodes, TriggersGuestNotExist, TriggersGuestNotRunning, TriggersNoBlockGiven, TriggersNoStageGiven, UIExpectsTTY, UnimplementedProviderAction, UploadInvalidCompressionType, UploadMissingExtractCapability, UploadMissingTempCapability, UploadSourceMissing, UploaderError, UploaderInterrupted, VBoxManageError, VBoxManageLaunchError, VBoxManageNotFoundError, VMBaseMacNotSpecified, VMBootBadState, VMBootTimeout, VMCloneFailure, VMCreateMasterFailure, VMCustomizationFailed, VMImportFailure, VMInaccessible, VMNameExists, VMNoMatchError, VMNotCreatedError, VMNotFoundError, VMNotRunningError, VMPowerOffToPackage, VagrantError, VagrantInterrupt, VagrantLocked, VagrantRemoteError, VagrantVersionBad, VagrantfileExistsError, VagrantfileLoadError, VagrantfileNameError, VagrantfileSyntaxError, VagrantfileTemplateNotFoundError, VagrantfileWriteError, VirtualBoxBrokenVersion040214, VirtualBoxConfigNotFound, VirtualBoxDisksControllerNotFound, VirtualBoxDisksDefinedExceedLimit, VirtualBoxDisksNoSupportedControllers, VirtualBoxDisksPrimaryNotFound, VirtualBoxDisksUnsupportedController, VirtualBoxGuestPropertyNotFound, VirtualBoxInstallIncomplete, VirtualBoxInvalidHostSubnet, VirtualBoxInvalidVersion, VirtualBoxKernelModuleNotLoaded, VirtualBoxMachineFolderNotFound, VirtualBoxMountFailed, VirtualBoxMountNotSupportedBSD, VirtualBoxNameExists, VirtualBoxNoName, VirtualBoxNoRoomForHighLevelNetwork, VirtualBoxNotDetected, VirtualBoxUserMismatch, VirtualBoxVersionEmpty, WSLRootFsNotFoundError, WSLVagrantAccessError, WSLVagrantVersionMismatch, WSLVirtualBoxWindowsAccessError, WinRMInvalidCommunicator