Sha256: 4afbcbcdf8e77ce82644ae8ca1eccbc8f976dcde949c6e41d8162498195d80fe
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
# frozen_string_literal: true require 'faraday' require 'bitbucket_rest_api/error' module BitBucket class Response::RaiseError < Faraday::Response::Middleware def on_complete(env) case env[:status].to_i when 400 raise BitBucket::Error::BadRequest, env when 401 raise BitBucket::Error::Unauthorized, env when 403 raise BitBucket::Error::Forbidden, env when 404 raise BitBucket::Error::NotFound, env when 422 raise BitBucket::Error::UnprocessableEntity, env when 500 raise BitBucket::Error::InternalServerError, env when 503 raise BitBucket::Error::ServiceUnavailable, env when 400...600 raise BitBucket::Error::ServiceError, env end end end # Response::RaiseError end # BitBucket
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bitbuckets-0.2.0 | lib/bitbucket_rest_api/response/raise_error.rb |