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, 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, CommunicatorNotFound, ConfigInvalid, ConfigUpgradeErrors, CopyPrivateKeyFailed, CorruptMachineIndex, CreateIsoHostCapNotFound, DarwinMountFailed, DarwinVersionFailed, DestroyRequiresForce, DotfileUpgradeJSONError, DownloadAlreadyInProgress, 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, 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, SSHKeyTypeNotSupportedByServer, 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, 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, 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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vagrant/errors.rb', line 65 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.
50 51 52 |
# File 'lib/vagrant/errors.rb', line 50 def extra_data @extra_data end |
Class Method Details
.error_key(key = nil, namespace = nil) ⇒ Object
52 53 54 55 |
# File 'lib/vagrant/errors.rb', line 52 def self.error_key(key=nil, namespace=nil) define_method(:error_key) { key } error_namespace(namespace) if namespace end |
.error_message(message) ⇒ Object
57 58 59 |
# File 'lib/vagrant/errors.rb', line 57 def self.() define_method(:error_message) { } end |
.error_namespace(namespace) ⇒ Object
61 62 63 |
# File 'lib/vagrant/errors.rb', line 61 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.
94 |
# File 'lib/vagrant/errors.rb', line 94 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.
85 |
# File 'lib/vagrant/errors.rb', line 85 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.
90 |
# File 'lib/vagrant/errors.rb', line 90 def error_namespace; "vagrant.errors"; end |
#status_code ⇒ Integer
This is the exit code that should be used when exiting from this exception.
100 |
# File 'lib/vagrant/errors.rb', line 100 def status_code; 1; end |