Skip to content

Commit

Permalink
display more validation errors on HTTP 422
Browse files Browse the repository at this point in the history
references #269, #189
  • Loading branch information
mislav committed Dec 17, 2012
1 parent dc7441e commit 975451f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/hub/github_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ def error_sentences
data['errors'].map do |err|
case err['code']
when 'custom' then err['message']
when 'missing_field' then "field '%s' is missing" % err['field']
when 'missing_field'
%(Missing field: "%s") % err['field']
when 'invalid'
%(Invalid value for "%s": "%s") % [ err['field'], err['value'] ]
when 'unauthorized'
%(Not allowed to change field "%s") % err['field']
end
end.compact if data['errors']
end
Expand Down

0 comments on commit 975451f

Please sign in to comment.