Exception: Vagrant::Errors::VagrantError
- Inherits:
-
StandardError
- Object
- StandardError
- Vagrant::Errors::VagrantError
- Defined in:
- lib/vagrant/errors.rb
Overview
Main superclass of any errors in Vagrant. This provides some
convenience methods for setting the status code and error key.
The status code is used by the vagrant
executable as the
error code, and the error key is used as a default message from
I18n.
Direct Known Subclasses
ActiveMachineWithDifferentProvider, AliasInvalidError, BatchMultiError, BoxAddDirectVersion, BoxAddMetadataMultiURL, BoxAddNameMismatch, BoxAddNameRequired, BoxAddNoMatchingProvider, BoxAddNoMatchingVersion, BoxAddShortNotFound, BoxAlreadyExists, BoxChecksumInvalidType, BoxChecksumMismatch, BoxConfigChangingBox, BoxFileNotExist, BoxMetadataCorrupted, BoxMetadataDownloadError, BoxMetadataFileNotFound, BoxMetadataMalformed, BoxMetadataMalformedVersion, BoxNotFound, BoxNotFoundWithProvider, BoxNotFoundWithProviderAndVersion, BoxProviderDoesntMatch, BoxRemoveMultiProvider, BoxRemoveMultiVersion, BoxRemoveNotFound, BoxRemoveProviderNotFound, BoxRemoveVersionNotFound, BoxServerNotSet, BoxUnpackageFailure, BoxUpdateMultiProvider, BoxUpdateNoMetadata, BoxVerificationFailed, BundlerDisabled, BundlerError, CFEngineBootstrapFailed, CFEngineCantAutodetectIP, CFEngineInstallFailed, CFEngineNotInstalled, CLIInvalidOptions, CLIInvalidUsage, CantReadMACAddresses, CapabilityHostExplicitNotDetected, CapabilityHostNotDetected, CapabilityInvalid, CapabilityNotFound, CloneMachineNotFound, CloneNotFound, CloudInitCommandFailed, CloudInitNotFound, CommandDeprecated, CommandSuspendAllArgs, CommandUnavailable, CommunicatorNotFound, ConfigInvalid, ConfigUpgradeErrors, CopyPrivateKeyFailed, CorruptMachineIndex, CreateIsoHostCapNotFound, DarwinMountFailed, DestroyRequiresForce, DotfileUpgradeJSONError, DownloaderChecksumError, DownloaderError, 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, PackageOutputDirectory, PackageOutputExists, PackageRequiresDirectory, PluginGemNotFound, PluginInitError, PluginInstallFailed, PluginInstallLicenseNotFound, PluginInstallSpace, PluginInstallVersionConflict, PluginLoadError, PluginMissingLocalError, 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, SyncedFolderUnusable, TriggersBadExitCodes, TriggersGuestNotExist, TriggersGuestNotRunning, TriggersNoBlockGiven, TriggersNoStageGiven, UIExpectsTTY, UnimplementedProviderAction, UploadInvalidCompressionType, UploadMissingExtractCapability, UploadMissingTempCapability, UploadSourceMissing, UploaderError, VBoxManageError, VBoxManageLaunchError, VBoxManageNotFoundError, VMBaseMacNotSpecified, VMBootBadState, VMBootTimeout, VMCloneFailure, VMCreateMasterFailure, VMCustomizationFailed, VMImportFailure, VMInaccessible, VMNameExists, VMNoMatchError, VMNotCreatedError, VMNotFoundError, VMNotRunningError, VMPowerOffToPackage, VagrantInterrupt, VagrantVersionBad, VagrantfileExistsError, VagrantfileLoadError, VagrantfileNameError, VagrantfileSyntaxError, VagrantfileTemplateNotFoundError, VagrantfileWriteError, VirtualBoxBrokenVersion040214, VirtualBoxDisksControllerNotFound, VirtualBoxDisksDefinedExceedLimit, VirtualBoxDisksNoSupportedControllers, VirtualBoxDisksPrimaryNotFound, VirtualBoxDisksUnsupportedController, VirtualBoxGuestPropertyNotFound, VirtualBoxInstallIncomplete, VirtualBoxInvalidVersion, VirtualBoxKernelModuleNotLoaded, VirtualBoxMountFailed, VirtualBoxMountNotSupportedBSD, VirtualBoxNameExists, VirtualBoxNoName, VirtualBoxNoRoomForHighLevelNetwork, VirtualBoxNotDetected, VirtualBoxUserMismatch, VirtualBoxVersionEmpty, WSLRootFsNotFoundError, WSLVagrantAccessError, WSLVagrantVersionMismatch, WSLVirtualBoxWindowsAccessError, WinRMInvalidCommunicator, Plugin::V1::Guest::BaseError
Instance Attribute Summary collapse
-
#extra_data ⇒ Object
This is extra data passed into the message for translation.
Class Method Summary collapse
- .error_key(key = nil, namespace = nil) ⇒ Object
- .error_message(message) ⇒ Object
- .error_namespace(namespace) ⇒ Object
Instance Method Summary collapse
-
#error_key ⇒ Object
The key for the error message.
-
#error_message ⇒ Object
The error message for this error.
-
#error_namespace ⇒ Object
The default error namespace which is used for the error key.
-
#initialize(*args) ⇒ VagrantError
constructor
A new instance of VagrantError.
-
#status_code ⇒ Integer
This is the exit code that should be used when exiting from this exception.
Constructor Details
#initialize(*args) ⇒ VagrantError
Returns a new instance of VagrantError.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/vagrant/errors.rb', line 62 def initialize(*args) key = args.shift if args.first.is_a?(Symbol) = args.shift if args.first.is_a?(Hash) ||= {} @extra_data = .dup [:_key] ||= error_key [:_namespace] ||= error_namespace [:_key] = key if key if [:_key] = translate_error() else = end super() end |
Instance Attribute Details
#extra_data ⇒ Object
This is extra data passed into the message for translation.
47 48 49 |
# File 'lib/vagrant/errors.rb', line 47 def extra_data @extra_data end |
Class Method Details
.error_key(key = nil, namespace = nil) ⇒ Object
49 50 51 52 |
# File 'lib/vagrant/errors.rb', line 49 def self.error_key(key=nil, namespace=nil) define_method(:error_key) { key } error_namespace(namespace) if namespace end |
.error_message(message) ⇒ Object
54 55 56 |
# File 'lib/vagrant/errors.rb', line 54 def self.() define_method(:error_message) { } end |
.error_namespace(namespace) ⇒ Object
58 59 60 |
# File 'lib/vagrant/errors.rb', line 58 def self.error_namespace(namespace) define_method(:error_namespace) { namespace } end |
Instance Method Details
#error_key ⇒ Object
The key for the error message. This should be set using the error_key method but can be overridden here if needed.
91 |
# File 'lib/vagrant/errors.rb', line 91 def error_key; nil; end |
#error_message ⇒ Object
The error message for this error. This is used if no error_key is specified for a translatable error message.
82 |
# File 'lib/vagrant/errors.rb', line 82 def ; "No error message"; end |
#error_namespace ⇒ Object
The default error namespace which is used for the error key. This can be overridden here or by calling the "error_namespace" class method.
87 |
# File 'lib/vagrant/errors.rb', line 87 def error_namespace; "vagrant.errors"; end |
#status_code ⇒ Integer
This is the exit code that should be used when exiting from this exception.
97 |
# File 'lib/vagrant/errors.rb', line 97 def status_code; 1; end |