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, BaseVMNotFound, BoxAlreadyExists, BoxDownloadUnknownType, BoxMetadataFileNotFound, BoxNotFound, BoxNotSpecified, BoxProviderDoesntMatch, BoxSpecifiedDoesntExist, BoxUnpackageFailure, BoxUpgradeRequired, BoxVerificationFailed, CLIInvalidOptions, CLIInvalidUsage, ConfigInvalid, ConfigUpgradeErrors, CopyPrivateKeyFailed, DestroyRequiresForce, DotfileIsDirectory, DotfileUpgradeJSONError, DownloaderFileDoesntExist, DownloaderHTTPConnectReset, DownloaderHTTPConnectTimeout, DownloaderHTTPSocketError, DownloaderHTTPStatusError, EnvironmentLockedError, EnvironmentNonExistentCWD, ForwardPortAdapterNotFound, ForwardPortAutolistEmpty, ForwardPortCollision, ForwardPortCollisionResume, GemCommandInBundler, HomeDirectoryMigrationFailed, HomeDirectoryNotAccessible, LocalDataDirectoryNotAccessible, MachineGuestNotReady, MachineNotFound, MachineStateInvalid, MultiVMEnvironmentRequired, MultiVMTargetRequired, NFSNoGuestIP, NFSNoHostIP, NFSNoHostonlyNetwork, NetworkAdapterCollision, NetworkCollision, NetworkDHCPAlreadyAttached, NetworkNoAdapters, NetworkNotFound, NoEnvironmentError, PackageIncludeMissing, PackageOutputDirectory, PackageOutputExists, PackageRequiresDirectory, PersistDotfileExists, PluginGemError, PluginInstallBadEntryPoint, PluginInstallLicenseNotFound, PluginInstallNotFound, PluginLoadError, PluginLoadFailed, PluginLoadFailedWithOutput, PluginNotFound, ProviderNotFound, SCPPermissionDenied, SCPUnavailable, SSHAuthenticationFailed, SSHConnectionRefused, SSHConnectionReset, SSHConnectionTimeout, SSHDisconnected, SSHHostDown, SSHKeyBadPermissions, SSHKeyTypeNotSupported, SSHNotReady, SSHPortNotDetected, SSHUnavailable, SSHUnavailableWindows, SharedFolderCreateFailed, UIExpectsTTY, UnimplementedProviderAction, VBoxManageError, VMBaseMacNotSpecified, VMCustomizationFailed, VMFailedToBoot, VMFailedToRun, VMGuestError, VMImportFailure, VMInaccessible, VMNameExists, VMNoMatchError, VMNotCreatedError, VMNotFoundError, VMNotRunningError, VMPowerOffToPackage, VagrantInterrupt, VagrantfileExistsError, VagrantfileLoadError, VagrantfileSyntaxError, VirtualBoxInstallIncomplete, VirtualBoxInvalidVersion, VirtualBoxKernelModuleNotLoaded, VirtualBoxNoRoomForHighLevelNetwork, VirtualBoxNotDetected, Plugin::V1::Guest::BaseError, Plugin::V2::Guest::BaseError
Class Method Summary collapse
Instance Method Summary collapse
-
#error_key ⇒ Object
The key for the error message.
-
#error_namespace ⇒ Object
The default error namespace which is used for the error key.
-
#initialize(message = nil, *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(message = nil, *args) ⇒ VagrantError
Returns a new instance of VagrantError.
55 56 57 58 59 60 61 |
# File 'lib/vagrant/errors.rb', line 55 def initialize(=nil, *args) = { :_key => } if && !.is_a?(Hash) = { :_key => error_key, :_namespace => error_namespace }.merge( || {}) = translate_error() super end |
Class Method Details
.error_key(key = nil, namespace = nil) ⇒ Object
46 47 48 49 |
# File 'lib/vagrant/errors.rb', line 46 def self.error_key(key=nil, namespace=nil) define_method(:error_key) { key } error_namespace(namespace) if namespace end |
.error_namespace(namespace) ⇒ Object
51 52 53 |
# File 'lib/vagrant/errors.rb', line 51 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.
70 |
# File 'lib/vagrant/errors.rb', line 70 def error_key; nil; 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.
66 |
# File 'lib/vagrant/errors.rb', line 66 def error_namespace; "vagrant.errors"; end |
#status_code ⇒ Integer
This is the exit code that should be used when exiting from this exception.
76 |
# File 'lib/vagrant/errors.rb', line 76 def status_code; 1; end |