Skip to content
Browse files

Added extra info to ironerror.

  • Loading branch information...
1 parent c4f2587 commit d5ace2f8bc9b84567492173daf7f05f25e45fb8b @treeder treeder committed May 11, 2012
Showing with 16 additions and 14 deletions.
  1. +2 −2 Gemfile
  2. +2 −10 Gemfile.lock
  3. +1 −1 Rakefile
  4. +1 −1 lib/iron_core/client.rb
  5. +10 −0 lib/iron_core/iron_error.rb
View
4 Gemfile
@@ -2,9 +2,9 @@ source 'http://rubygems.org'
gem 'rest-client'
gem 'rest'
-gem 'json'
+#gem 'json'
gem 'bundler', '> 1.0.0'
group :development do
- gem 'jeweler', '~> 1.8.3'
+ gem 'jeweler2'
end
View
12 Gemfile.lock
@@ -2,16 +2,9 @@ GEM
remote: http://rubygems.org/
specs:
git (1.2.5)
- jeweler (1.8.3)
- bundler (~> 1.0)
+ jeweler2 (2.0.9)
git (>= 1.2.5)
- rake
- rdoc
- json (1.6.6)
mime-types (1.18)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
rest (0.2.0)
rest-client
rest-client
@@ -23,7 +16,6 @@ PLATFORMS
DEPENDENCIES
bundler (> 1.0.0)
- jeweler (~> 1.8.3)
- json
+ jeweler2
rest
rest-client
View
2 Rakefile
@@ -1,6 +1,6 @@
require 'rubygems'
require 'bundler'
-require 'jeweler'
+require 'jeweler2'
Jeweler::Tasks.new do |gem|
begin
View
2 lib/iron_core/client.rb
@@ -127,7 +127,7 @@ def post_file(method, file, params = {})
def parse_response(response, parse_json = true)
IronCore::Logger.debug 'IronCore', "GOT #{response.code} with params='#{response.body}'"
- raise IronCore::IronError.new(response.body) if response.code != 200
+ raise IronCore::IronError.new(response) if response.code != 200
return response.body unless parse_json
JSON.parse(response.body)
View
10 lib/iron_core/iron_error.rb
@@ -1,4 +1,14 @@
module IronCore
class IronError < Exception
+
+ def initialize(response)
+ super(response.body)
+ @response = response
+ end
+
+ def code
+ return @response.code if @response
+ end
+
end
end

0 comments on commit d5ace2f

Please sign in to comment.
Something went wrong with that request. Please try again.