Skip to content

Commit df89e28

Browse files
DiscourseApi::Timeout should inherit from DiscourseApi::Error (#240)
Co-authored-by: Akshay Birajdar <akshay.birajdar@coupa.com> Co-authored-by: Akshay Birajdar <akshay.birajdar@coupa.com>
1 parent e3fd241 commit df89e28

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/discourse_api/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ class UnprocessableEntity < DiscourseError
3434
class TooManyRequests < DiscourseError
3535
end
3636

37-
class Timeout < DiscourseError
37+
class Timeout < Error
3838
end
3939
end

spec/discourse_api/client_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
expect(subject.send(:connection).options.timeout).to eq(25)
4242
end
4343
end
44+
45+
it "raises DiscourseApi::Timeout" do
46+
stub_get("#{host}/t/1.json").to_timeout
47+
48+
expect { subject.topic(1) }.to raise_error(DiscourseApi::Timeout)
49+
end
4450
end
4551

4652
describe "#api_key" do

0 commit comments

Comments
 (0)