http-exceptions 0.1.1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 03bd2eec282320ea2757da660f823694333ec23d
4
- data.tar.gz: aa793159eb0c1f53c1528a250f7272664e41f871
2
+ SHA256:
3
+ metadata.gz: c36c4d6a2dd82b84e931d9e6ed2de3ede39a73e1b6c92a939f95e1d4c8729fe8
4
+ data.tar.gz: cbd55955c1a0e87bb1dfa2b2e1e0ee5caf3b244d519a0165dc23b5bd804ae3a9
5
5
  SHA512:
6
- metadata.gz: dd355b76607a59d58bb287af11e062e0912ddb08cd0adca784ca96cc373bb0194a9ccfdbe768c66473becd39c1253d4246c1f267f10e4910e597b6b1090fb0dc
7
- data.tar.gz: bbc6ecf77d7ec8913adafe9e7b19ae008d76f3a42f4cf0ee102670882361c2ed83e81dbe5ebeb3454721303f0217ce72886ae89b8e2908aeeb7af5a0a78ab324
6
+ metadata.gz: 39e4f5c9d98c047ef775459ac01ed108ed30d9b88320d3ce02d7c683e33227f64a36aaeb4a2db7396d1483e8cc266b43186dd2a0bb3b8c9fd29119215e6ad64f
7
+ data.tar.gz: c243f850a854f6578b45c98dfc3f68c8d4454d1b46b16ed6ed2b037a29a6725a35c3e0c9efee0125329af566be69e07ae79755df26c90686c89a891d97a3288c
@@ -0,0 +1,89 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ test:
5
+ parameters:
6
+ ruby:
7
+ type: string
8
+ docker:
9
+ - image: cimg/ruby:<< parameters.ruby >>
10
+ auth:
11
+ username: $DOCKERHUB_USERNAME
12
+ password: $DOCKERHUB_TOKEN
13
+ steps:
14
+ - checkout
15
+ - run:
16
+ name: Install Ruby gems
17
+ command: |
18
+ bundle config set --local path vendor/bundle
19
+ bundle check || bundle install --jobs=4 --retry=3
20
+ - run:
21
+ name: Set up test output directory
22
+ command: sudo install -o circleci -d ~/rspec
23
+ - run:
24
+ name: RSpec
25
+ command: |
26
+ bundle exec rspec \
27
+ --color \
28
+ --require spec_helper \
29
+ --format documentation \
30
+ --format RspecJunitFormatter \
31
+ --out ~/rspec/rspec.xml
32
+ push_to_rubygems:
33
+ docker:
34
+ - image: circleci/ruby:2.7.4
35
+ auth:
36
+ username: $DOCKERHUB_USERNAME
37
+ password: $DOCKERHUB_TOKEN
38
+ steps:
39
+ - checkout
40
+ - run:
41
+ name: Create .gem/credentials file
42
+ command: |
43
+ mkdir ~/.gem
44
+ echo "---
45
+ :rubygems_api_key: $RUBYGEMS_API_KEY
46
+ " > ~/.gem/credentials
47
+ chmod 600 ~/.gem/credentials
48
+ - run:
49
+ name: Release
50
+ command: |
51
+ gem build http-exceptions
52
+ gem push http-exceptions*.gem
53
+
54
+ workflows:
55
+ version: 2
56
+ test_and_deploy:
57
+ jobs:
58
+ - test:
59
+ matrix:
60
+ alias: old-ruby
61
+ parameters:
62
+ ruby: ["2.7", "3.0"]
63
+ filters:
64
+ tags:
65
+ only:
66
+ - /^v.*/
67
+ context:
68
+ - DockerHub
69
+ - test:
70
+ ruby: "3.1"
71
+ filters:
72
+ tags:
73
+ only:
74
+ - /^v.*/
75
+ context:
76
+ - DockerHub
77
+ - push_to_rubygems:
78
+ requires:
79
+ - test
80
+ filters:
81
+ branches:
82
+ ignore:
83
+ - /.*/
84
+ tags:
85
+ only:
86
+ - /^v.*/
87
+ context:
88
+ - DockerHub
89
+ - RubyGems
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.7.4
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Http::Exceptions
4
4
 
5
- Http::Exceptions provides an easy way to rescue exceptions that might be thrown by your Http library.
5
+ Http::Exceptions provides an easy way to rescue exceptions that might be thrown by your Http library. This was developed at Rainforest QA - you can read more in [Introducing Http::Exceptions](https://www.rainforestqa.com/blog/2014-08-15-introducing-http-exceptions/) over on our blog.
6
6
 
7
7
  If you're using a library such as the excellent [HTTParty](https://github.com/jnunemaker/httparty), you still have to deal with various types of exceptions. In an ideal world, the return code of the HTTP request would be the sole indicator of failures, but HTTP libraries can raise a large number of exceptions (such as `SocketError` or `Net::ReadTimeout`) that you need to handle.
8
8
 
@@ -6,11 +6,11 @@ require 'http/exceptions/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "http-exceptions"
8
8
  spec.version = Http::Exceptions::VERSION
9
- spec.authors = ["Simon Mathieu", "Russell Smith"]
10
- spec.email = ["simon.math@gmail.com", "russ@rainforestqa.com"]
11
- spec.summary = %q{An easy way to rescue exceptions that might be thrown by your HTTP library}
12
- spec.description = %q{An easy way to rescue exceptions that might be thrown by your HTTP library}
13
- spec.homepage = "https://github.com/rainforestapp/http-exceptions"
9
+ spec.authors = ["Simon Mathieu"]
10
+ spec.email = ["simon.math@gmail.com"]
11
+ spec.summary = %q{An easy way to rescue exceptions that might be thrown by your Http library}
12
+ spec.description = %q{An easy way to rescue exceptions that might be thrown by your Http library}
13
+ spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "bundler", "~> 2.2"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency 'rspec_junit_formatter'
23
25
  end
@@ -1,3 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Some stdlib need to be required for accessing those error classes
4
+ # Required for bundler 1.14.5
5
+ require "net/http"
6
+ require "openssl"
7
+ require "socket"
8
+
1
9
  module Http
2
10
  module Exceptions
3
11
  class Configuration
@@ -6,7 +6,7 @@ module Http
6
6
  def initialize(options = {})
7
7
  @original_exception = options[:original_exception]
8
8
  @response = options[:response]
9
- msg = "An error as occured while processing response."
9
+ msg = 'An error has occurred while processing response.'
10
10
  msg += " Status #{response.code}\n#{response.body}" if response
11
11
  msg += " Original Exception: #{original_exception}" if original_exception
12
12
  super msg
@@ -1,5 +1,5 @@
1
1
  module Http
2
2
  module Exceptions
3
- VERSION = "0.1.1"
3
+ VERSION = '0.1.6'.freeze
4
4
  end
5
5
  end
@@ -4,22 +4,6 @@ require "http/exceptions/http_exception"
4
4
 
5
5
  module Http
6
6
  module Exceptions
7
- EXCEPTIONS = [
8
- SocketError,
9
- Errno::ETIMEDOUT,
10
- (Net.const_defined?(:ReadTimeout) ? Net::ReadTimeout : EOFError),
11
- (Net.const_defined?(:OpenTimeout) ? Net::OpenTimeout : EOFError),
12
- Net::ProtocolError,
13
- Errno::ECONNREFUSED,
14
- Errno::EHOSTDOWN,
15
- Errno::ECONNRESET,
16
- Errno::ENETUNREACH,
17
- Errno::EHOSTUNREACH,
18
- Errno::ECONNABORTED,
19
- OpenSSL::SSL::SSLError,
20
- EOFError,
21
- ].freeze
22
-
23
7
  def self.wrap_exception
24
8
  begin
25
9
  yield
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-exceptions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Mathieu
8
- - Russell Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2022-12-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -17,14 +16,14 @@ dependencies:
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: '1.6'
19
+ version: '2.2'
21
20
  type: :development
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: '1.6'
26
+ version: '2.2'
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: rake
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,17 +38,45 @@ dependencies:
39
38
  - - ">="
40
39
  - !ruby/object:Gem::Version
41
40
  version: '0'
42
- description: An easy way to rescue exceptions that might be thrown by your HTTP library
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: An easy way to rescue exceptions that might be thrown by your Http library
43
70
  email:
44
71
  - simon.math@gmail.com
45
- - russ@rainforestqa.com
46
72
  executables: []
47
73
  extensions: []
48
74
  extra_rdoc_files: []
49
75
  files:
76
+ - ".circleci/config.yml"
50
77
  - ".gitignore"
51
78
  - ".rspec"
52
- - ".travis.yml"
79
+ - ".ruby-version"
53
80
  - Gemfile
54
81
  - LICENSE.txt
55
82
  - README.md
@@ -62,7 +89,7 @@ files:
62
89
  - spec/http/exceptions/configuration_spec.rb
63
90
  - spec/http_exception_spec.rb
64
91
  - spec/spec_helper.rb
65
- homepage: https://github.com/rainforestapp/http-exceptions
92
+ homepage: ''
66
93
  licenses:
67
94
  - MIT
68
95
  metadata: {}
@@ -81,11 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
108
  - !ruby/object:Gem::Version
82
109
  version: '0'
83
110
  requirements: []
84
- rubyforge_project:
85
- rubygems_version: 2.5.1
111
+ rubygems_version: 3.1.6
86
112
  signing_key:
87
113
  specification_version: 4
88
- summary: An easy way to rescue exceptions that might be thrown by your HTTP library
114
+ summary: An easy way to rescue exceptions that might be thrown by your Http library
89
115
  test_files:
90
116
  - spec/http/exceptions/configuration_spec.rb
91
117
  - spec/http_exception_spec.rb
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- # Send builds to container-based infrastructure
2
- # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
3
- sudo: false
4
- language: ruby
5
- cache:
6
- - bundler
7
- rvm:
8
- - 2.0
9
- - 2.1.8
10
- - 2.2.4
11
- - 2.3.0
12
- - ruby-head
13
- script: bundle exec rspec spec
14
- # ! Update bundler before running test in Travis to avoid buggy version of bundler
15
- before_install:
16
- - gem update bundler
17
- matrix:
18
- fast_finish: true
19
- allow_failures:
20
- - rvm: ruby-head