Skip to content

Commit

Permalink
Update error_message to print request uri on response failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Izaak Alpert committed Aug 13, 2013
1 parent 9fb8317 commit 8db4e88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/gitlab/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def validate(response)
end

def error_message(response)
"Server responded with code #{response.code}, message: #{response.parsed_response.message}"
"Server responded with code #{response.code}, message: #{response.parsed_response.message}. For request:#{response.request.base_uri}#{response.request.path.to_s}"
end

# Sets a base_uri and private_token parameter for requests.
Expand Down
2 changes: 1 addition & 1 deletion spec/gitlab/client/user_teams_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
stub_request(:post, "#{Gitlab.endpoint}/user_teams/3/members").
with(:query => {:private_token => Gitlab.private_token}).
to_return({:body => load_fixture("error_already_exists"), :status => 409})
expect {Gitlab.add_user_team_member(3, 1, 40)}.to raise_error(Gitlab::Error::Conflict) {|e|e.message.should == "Server responded with code 409, message: 409 Already exists"}
expect {Gitlab.add_user_team_member(3, 1, 40)}.to raise_error(Gitlab::Error::Conflict) {|e|e.message.should == "Server responded with code 409, message: 409 Already exists. For request:#{Gitlab.endpoint}/user_teams/3/members"}
end
end
end
Expand Down

0 comments on commit 8db4e88

Please sign in to comment.