Skip to content

Commit

Permalink
handle response code 405
Browse files Browse the repository at this point in the history
  • Loading branch information
NARKOZ committed Oct 20, 2013
1 parent bc03c72 commit da31730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/gitlab/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class Forbidden < Error; end
# Raised when API endpoint returns the HTTP status code 404.
class NotFound < Error; end

# Raised when API endpoint returns the HTTP status code 405.
class MethodNotAllowed < Error; end

# Raised when API endpoint returns the HTTP status code 409.
class Conflict < Error; end

Expand Down
1 change: 1 addition & 0 deletions lib/gitlab/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def validate(response)
when 401; raise Error::Unauthorized.new error_message(response)
when 403; raise Error::Forbidden.new error_message(response)
when 404; raise Error::NotFound.new error_message(response)
when 405; raise Error::MethodNotAllowed.new error_message(response)
when 409; raise Error::Conflict.new error_message(response)
when 500; raise Error::InternalServerError.new error_message(response)
when 502; raise Error::BadGateway.new error_message(response)
Expand Down

0 comments on commit da31730

Please sign in to comment.