Module: HCloud::Errors
- Defined in:
- lib/hcloud/errors.rb
Defined Under Namespace
Classes: ActionFailed, CloudResourceIPNotAllowed, Conflict, DeprecatedApiEndpoint, Error, 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
Constant Summary collapse
- ACRONYMS =
Acronyms used in error class names
{ "ip" => "IP", "ipv4" => "IPv4", "ipv6" => "IPv6", "json" => "JSON", }.freeze
Class Method Summary collapse
-
.for(code) ⇒ Object
Look up the error class for an API error code (e.g. "primary_ip_assigned" => PrimaryIPAssigned).
Class Method Details
.for(code) ⇒ Object
Look up the error class for an API error code (e.g. "primary_ip_assigned" => PrimaryIPAssigned)
16 17 18 |
# File 'lib/hcloud/errors.rb', line 16 def self.for(code) const_get(code.to_s.split("_").map { |word| ACRONYMS.fetch(word) { word.capitalize } }.join) end |