From 7be2a36238200fbbb83fbb33cc21a6cd394a2960 Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Fri, 15 Jan 2016 15:53:15 -0800 Subject: [PATCH 1/3] More informative error messages for generic errors --- lib/protip/error.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/protip/error.rb b/lib/protip/error.rb index c5dcf8b..a87233f 100644 --- a/lib/protip/error.rb +++ b/lib/protip/error.rb @@ -8,6 +8,12 @@ class Error < RuntimeError def initialize(request, response) @request = request @response = response + + msg = <<-MSG +Received HTTP #{response.code} from #{request.uri}. Response: +#{response.body} + MSG + super(msg) end def inspect From 70027c7ee6e75259158555bc8c39087c70637298 Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Fri, 15 Jan 2016 16:02:10 -0800 Subject: [PATCH 2/3] Test fixes --- test/unit/protip/resource_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unit/protip/resource_test.rb b/test/unit/protip/resource_test.rb index fb7119b..b0138f4 100644 --- a/test/unit/protip/resource_test.rb +++ b/test/unit/protip/resource_test.rb @@ -667,7 +667,13 @@ def self.it_converts_query_parameters # Set up an errors instance variable that we can set actual messages on @errors = Protip::Messages::Errors.new - exception = Protip::UnprocessableEntityError.new mock, mock + request = mock + request.stubs(:uri).returns('http://some.uri') + + response = mock + response.stubs(code: 500, body: @errors.to_proto) + + exception = Protip::UnprocessableEntityError.new request, response exception.stubs(:errors).returns @errors client.stubs(:request).raises(exception) From 7869e6614f2796ea8229ad8f2aaf60fc24aeaf6b Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Fri, 15 Jan 2016 16:04:00 -0800 Subject: [PATCH 3/3] Bump version --- protip.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protip.gemspec b/protip.gemspec index bb6a0df..0e2325f 100644 --- a/protip.gemspec +++ b/protip.gemspec @@ -1,7 +1,7 @@ # encoding: utf-8 Gem::Specification.new do |spec| spec.name = 'protip' - spec.version = '0.16.0' + spec.version = '0.16.1' spec.summary = 'ActiveModel resources backed by protocol buffers' spec.licenses = ['MIT'] spec.homepage = 'https://github.com/AngelList/protip'