Exception: HCloud::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- HCloud::Errors::Error
- Defined in:
- lib/hcloud/errors.rb
Direct Known Subclasses
ActionFailed, CloudResourceIPNotAllowed, Conflict, FirewallAlreadyApplied, FirewallAlreadyRemoved, FirewallResourceNotFound, Forbidden, IPNotAvailable, IPNotOwned, IncompatibleNetworkType, InvalidInput, InvalidLoadBalancerType, JSONError, LoadBalancerNotAttachedToNetwork, Locked, Maintenance, MissingIDError, NetworksOverlap, NoSpaceLeftInLocation, NoSubnetAvailable, NotFound, PlacementError, PrimaryIPAlreadyAssigned, PrimaryIPAssigned, PrimaryIPDatacenterMismatch, PrimaryIPVersionMismatch, Protected, RateLimitExceeded, ResourceInUse, ResourceLimitExceeded, ResourceUnavailable, RobotUnavailable, ServerAlreadyAdded, ServerAlreadyAttached, ServerError, ServerHasIPv4, ServerHasIPv6, ServerIsLoadBalancerTarget, ServerNotAttachedToNetwork, ServerNotStopped, ServiceError, SourcePortAlreadyUsed, TargetAlreadyDefined, TargetsWithoutUsePrivateIP, TokenReadonly, Unauthorized, Unavailable, UniquenessError, UnsupportedError
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #full_messages ⇒ Object
-
#initialize(data = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(data = {}) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 |
# File 'lib/hcloud/errors.rb', line 8 def initialize(data = {}) @data = data super([data[:message], &.join("\n")].compact.join("\n\n")) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/hcloud/errors.rb', line 6 def data @data end |
Instance Method Details
#full_messages ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/hcloud/errors.rb', line 14 def return unless data[:details] data[:details][:fields].flat_map do |field| Array(field.fetch(:messages, data[:message])).map do |detail| "#{field[:name]} #{detail}" end end end |