dnsimple-ruby 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
@@ -16,7 +16,13 @@ module DNSimple
16
16
  end
17
17
  end
18
18
 
19
- class AuthenticationFailed < DNSimple::Error; end
19
+ class RecordNotFound < DNSimple::Error; end
20
+
21
+ class AuthenticationFailed < DNSimple::Error
22
+ def initialize(message="Authentication failed")
23
+ super(message)
24
+ end
25
+ end
20
26
 
21
27
  class UserNotFound < DNSimple::Error; end
22
28
 
@@ -45,9 +45,9 @@ module DNSimple
45
45
  when 200
46
46
  return self
47
47
  when 401
48
- raise RuntimeError, "Authentication failed"
48
+ raise DNSimple::AuthenticationFailed
49
49
  else
50
- raise RuntimeError, "Failed to update record: #{response.inspect}"
50
+ raise DNSimple::Error, "Failed to update record: #{response.inspect}"
51
51
  end
52
52
  end
53
53
 
@@ -82,11 +82,11 @@ module DNSimple
82
82
  when 201
83
83
  return DNSimple::Record.new({:domain => domain}.merge(response["record"]))
84
84
  when 401
85
- raise RuntimeError, "Authentication failed"
85
+ raise DNSimple::AuthenticationFailed
86
86
  when 406
87
87
  raise DNSimple::RecordExists.new("#{name}.#{domain.name}", response["errors"])
88
88
  else
89
- raise DNSimple::Error.new("#{name}.#{domain.name}", response["errors"])
89
+ raise DNSimple::Error, "Failed to create #{name}.#{domain.name}: #{response["errors"]}"
90
90
  end
91
91
  end
92
92
 
@@ -100,11 +100,11 @@ module DNSimple
100
100
  when 200
101
101
  return DNSimple::Record.new({:domain => domain}.merge(response["record"]))
102
102
  when 401
103
- raise RuntimeError, "Authentication failed"
103
+ raise DNSimple::AuthenticationFailed
104
104
  when 404
105
- raise RuntimeError, "Could not find record #{id} for domain #{domain.name}"
105
+ raise DNSimple::RecordNotFound, "Could not find record #{id} for domain #{domain.name}"
106
106
  else
107
- raise DNSimple::Error.new("#{domain.name}/#{id}", response["errors"])
107
+ raise DNSimple::Error, "Failed to find domain #{domain.name}/#{id}: #{response["errors"]}"
108
108
  end
109
109
  end
110
110
 
@@ -118,9 +118,9 @@ module DNSimple
118
118
  when 200
119
119
  response.map { |r| DNSimple::Record.new({:domain => domain}.merge(r["record"])) }
120
120
  when 401
121
- raise RuntimeError, "Authentication failed"
121
+ raise DNSimple::AuthenticationFailed, "Authentication failed"
122
122
  else
123
- raise RuntimeError, "Error: #{response.code}"
123
+ raise DNSimple::Error, "Error listing domains: #{response.code}"
124
124
  end
125
125
  end
126
126
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 3
10
- version: 1.2.3
9
+ - 4
10
+ version: 1.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Eden