Class: VagrantNfs4j::Nfs4jDaemon::Nfs4jDaemonErrors
- Inherits:
-
Vagrant::Errors::VagrantError
- Object
- Vagrant::Errors::VagrantError
- VagrantNfs4j::Nfs4jDaemon::Nfs4jDaemonErrors
- Defined in:
- lib/vagrant-nfs4j/nfs4j_daemon/errors.rb
Direct Known Subclasses
AttachFailed, DetachFailed, Nfs4jUnavailable, StartFailed, StatusFailed, StopFailed, TimeoutError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Nfs4jDaemonErrors
constructor
A new instance of Nfs4jDaemonErrors.
Constructor Details
#initialize(*args) ⇒ Nfs4jDaemonErrors
Returns a new instance of Nfs4jDaemonErrors.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vagrant-nfs4j/nfs4j_daemon/errors.rb', line 24 def initialize(*args) key = args.shift if args.first.is_a?(Symbol) = args.shift if args.first.is_a?(Hash) ||= {} cause = $! if (cause) [:cause] = cause. if cause.is_a?(RestClient::Exception) begin if cause.http_headers[:content_type] == "application/json" error = JSON.parse(cause.http_body) if error['error'] [:cause] += " [#{error['message']}]" = extra_data.merge(error) end end rescue # Do nothing end end end args.push(key) if key args.push() super(*args) end |
Class Method Details
.get_message(cause) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant-nfs4j/nfs4j_daemon/errors.rb', line 7 def self.(cause) = cause. if cause.is_a?(RestClient::Exception) begin if cause.http_headers[:content_type] == "application/json" error = JSON.parse(cause.http_body) if error['error'] += " [#{error['message']}]" end end rescue # Do nothing end end end |