Skip to content

Commit 34e9555

Browse files
committed
removes code as a property of OpenTokException, fixes #48
1 parent a5982a8 commit 34e9555

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/open_tok/exception.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ module OpenTok
1111
# The exception that gets thrown when an invalid api-key and/or secret is given.
1212
class OpenTokException < RuntimeError
1313

14-
def initialize(code, message)
15-
@code = code
14+
def initialize(message)
1615
@mesasge = message
1716
end
1817

@@ -29,11 +28,9 @@ def exceptions
2928
# Generates the relevant exception instance based on the XML error data received
3029
def from_error(error)
3130
child = error.get_elements('Errors')[0].get_elements('error')[0]
32-
code = child.attributes['code']
33-
exception = exceptions.find{|exc| exc.http_code == code }
3431
exception ||= self
3532
message = child.children.empty? ? '' : child.children[0].attributes['message']
36-
exception.new code, message
33+
exception.new message
3734
end
3835

3936
# To be overriden by subclasses
@@ -50,4 +47,4 @@ def self.http_code
5047
end
5148
end
5249

53-
end
50+
end

lib/open_tok/request.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def fetch(path, params={})
4444
end
4545

4646
rescue Net::HTTPExceptions => e
47-
raise OpenTokException.new e.response.code, "Unable to create fufill request: #{e}"
47+
raise OpenTokException.new "Unable to create fufill request: #{e}"
4848
rescue NoMethodError => e
49-
raise OpenTokException.new e.response.code, "Unable to create a fufill request at this time: #{e}"
49+
raise OpenTokException.new "Unable to create a fufill request at this time: #{e}"
5050
end
5151

5252
private

0 commit comments

Comments
 (0)