Sha256: 2ade3bff3e12118f639be29f618e4686f944dd864a1f1680217fa9bb6c9eaf19
Contents?: true
Size: 557 Bytes
Versions: 2
Compression:
Stored size: 557 Bytes
Contents
module Solusvm class SolusvmErrors < Faraday::Response::Middleware def on_complete(env) if (200..299).include? env[:status] # Checks for application errors case env[:body].downcase when /invalid ipaddress/i raise "This IP is not authorized to use the API" when /Invalid id or key/i raise "Invalid ID or key" when /Node not found/i raise "Node does not exist" end else raise SolusvmError, "Bad HTTP Status: #{env[:status]}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solusvm-1.1.0.beta2 | lib/solusvm/solusvm_errors.rb |
solusvm-1.1.0.beta1 | lib/solusvm/solusvm_errors.rb |