Exception: HCloud::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- HCloud::Errors::Error
- Defined in:
- lib/hcloud/errors.rb
Direct Known Subclasses
ActionFailed, CloudResourceIPNotAllowed, Conflict, DeprecatedApiEndpoint, FirewallAlreadyApplied, FirewallAlreadyRemoved, FirewallResourceNotFound, Forbidden, IPNotAvailable, IPNotOwned, IncompatibleNetworkType, IncorrectZoneMode, InvalidInput, InvalidLoadBalancerType, JSONError, LoadBalancerNotAttachedToNetwork, LoadBalancerPublicInterfaceDisabled, Locked, Maintenance, MissingIDError, MustBeUnassigned, NetworksOverlap, NoSpaceLeftInLocation, NoSubnetAvailable, NotFound, PlacementError, PrimaryIPAlreadyAssigned, PrimaryIPAssigned, PrimaryIPBlocked, PrimaryIPDatacenterMismatch, PrimaryIPLocationMismatch, 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.
23 24 25 26 27 |
# File 'lib/hcloud/errors.rb', line 23 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.
21 22 23 |
# File 'lib/hcloud/errors.rb', line 21 def data @data end |
Instance Method Details
#full_messages ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/hcloud/errors.rb', line 29 def return unless data[:details] && data[:details][:fields] data[:details][:fields].flat_map do |field| Array(field.fetch(:messages, data[:message])).map do |detail| "#{field[:name]} #{detail}" end end end |