lib/tumbz/middleware/parse.rb in tumbz-0.0.1 vs lib/tumbz/middleware/parse.rb in tumbz-0.0.2
- old
+ new
@@ -8,10 +8,10 @@
def parse(body)
json = MultiJson.load(body, :symbolize_keys => true)
errors = []
metadata = json.delete(:metadata) || []
- if json[:error].present?
+ if json.is_a?(Hash) and json[:error].present?
json.delete(:error)
json.delete(:message)
errors = [json.delete(:developerMessage)]
end