DiscourseApi::Timeout should inherit from DiscourseApi::Error (#240)

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

diff --git a/lib/discourse_api/error.rb b/lib/discourse_api/error.rb
index 5e6f554..2c151cb 100644
--- a/lib/discourse_api/error.rb
+++ b/lib/discourse_api/error.rb
@@ -34,6 +34,6 @@ module DiscourseApi
   class TooManyRequests < DiscourseError
   end
 
-  class Timeout < DiscourseError
+  class Timeout < Error
   end
 end
diff --git a/spec/discourse_api/client_spec.rb b/spec/discourse_api/client_spec.rb
index 7bcdbfd..91e2283 100644
--- a/spec/discourse_api/client_spec.rb
+++ b/spec/discourse_api/client_spec.rb
@@ -41,6 +41,12 @@ describe DiscourseApi::Client do
         expect(subject.send(:connection).options.timeout).to eq(25)
       end
     end
+
+    it "raises DiscourseApi::Timeout" do
+      stub_get("#{host}/t/1.json").to_timeout
+
+      expect { subject.topic(1) }.to raise_error(DiscourseApi::Timeout)
+    end
   end
 
   describe "#api_key" do

GitHub sha: df89e287a2aa15930925ed671b1e117f0771bd40

This commit appears in #240 which was approved by eviltrout. It was merged by eviltrout.