gitlab-triage 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85ef311a9c0950dacc0823958bf5a5a61ead1dbc6696599d5a9c1ed9d1cc5ca7
4
- data.tar.gz: 421ccd2c8d050659990ad07a8493d23bac378224acd94f47997cfaeec3633b04
3
+ metadata.gz: 403aa273677c675e590d5c2a46c0feb1d5087e1369532cb7c3b063e79191bc8c
4
+ data.tar.gz: 2f25cbdcad4c7b8ddd861d026711e396d8c1f9cc01f489a65166954694bc344c
5
5
  SHA512:
6
- metadata.gz: 706a9954e233b3a7c427068194e25a998fd193fd6373f5d82ad2f152935c2ca9ec16fd61301c687fac057b4972ccadfcc34bc52d44821494bd908cd5eae32b6e
7
- data.tar.gz: 639d905c6dce18d3d1af351897a05800e4cb708a7673dc325887d0b38a58d62c54dc85afdf084705ec713ec9d3d9c06273fc7b8afce5e8644a3fada7193b5d2b
6
+ metadata.gz: 27804c7a88c2079a8559593381e4aa6a0a94bbc6b0d5f23e4624227953fb75b57d177f79b86dbb09ee0836c2be0f9637ac7f762da80f955ae88294943cd1d6fa
7
+ data.tar.gz: 5ba384a4eb246540da8d23250240af00f4bdc30aa16e1dc17a1fbd4c294f3463e0a9cfefdce653d942ae738c7abc90ad55c28aff95f4c820247d027a18f2459b
@@ -0,0 +1 @@
1
+ require 'gitlab/triage/errors/network'
@@ -0,0 +1,9 @@
1
+ module Gitlab
2
+ module Triage
3
+ module Errors
4
+ module Network
5
+ InternalServerError = Class.new(StandardError)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -3,6 +3,7 @@ require 'net/protocol'
3
3
 
4
4
  require_relative 'retryable'
5
5
  require_relative 'ui'
6
+ require_relative 'errors'
6
7
 
7
8
  module Gitlab
8
9
  module Triage
@@ -31,7 +32,7 @@ module Gitlab
31
32
  begin
32
33
  print '.'
33
34
 
34
- response = execute_with_retry(Net::ReadTimeout) do
35
+ response = execute_with_retry([Net::ReadTimeout, Errors::Network::InternalServerError]) do
35
36
  puts Gitlab::Triage::UI.debug "query_api: #{url}" if options.debug
36
37
 
37
38
  @adapter.get(token, response.fetch(:next_page_url) { url })
@@ -2,6 +2,7 @@ require 'httparty'
2
2
 
3
3
  require_relative 'base_adapter'
4
4
  require_relative '../ui'
5
+ require_relative '../errors'
5
6
 
6
7
  module Gitlab
7
8
  module Triage
@@ -17,6 +18,7 @@ module Gitlab
17
18
  )
18
19
 
19
20
  raise_on_unauthorized_error!(response)
21
+ raise_on_internal_server_error!(response)
20
22
 
21
23
  {
22
24
  more_pages: (response.headers["x-next-page"].to_s != ""),
@@ -38,6 +40,7 @@ module Gitlab
38
40
  )
39
41
 
40
42
  raise_on_unauthorized_error!(response)
43
+ raise_on_internal_server_error!(response)
41
44
 
42
45
  {
43
46
  results: response.parsed_response,
@@ -52,8 +55,17 @@ module Gitlab
52
55
  return unless response.response.is_a?(Net::HTTPUnauthorized)
53
56
 
54
57
  puts Gitlab::Triage::UI.debug response.inspect if options.debug
58
+
55
59
  raise 'The provided token is unauthorized!'
56
60
  end
61
+
62
+ def raise_on_internal_server_error!(response)
63
+ return unless response.response.is_a?(Net::HTTPInternalServerError)
64
+
65
+ puts Gitlab::Triage::UI.debug response.inspect if options.debug
66
+
67
+ raise Errors::Network::InternalServerError, 'Internal server error encountered!'
68
+ end
57
69
  end
58
70
  end
59
71
  end
@@ -5,7 +5,7 @@ module Gitlab
5
5
 
6
6
  attr_accessor :tries
7
7
 
8
- def execute_with_retry(exception_type = StandardError)
8
+ def execute_with_retry(exception_types = [StandardError])
9
9
  @tries = 0
10
10
 
11
11
  until maximum_retries_reached?
@@ -13,7 +13,7 @@ module Gitlab
13
13
  @tries += 1
14
14
  result = yield
15
15
  break
16
- rescue exception_type
16
+ rescue *exception_types
17
17
  raise if maximum_retries_reached?
18
18
  end
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Triage
3
- VERSION = '1.6.0'.freeze
3
+ VERSION = '1.6.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-triage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-31 00:00:00.000000000 Z
11
+ date: 2020-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -146,6 +146,8 @@ files:
146
146
  - lib/gitlab/triage/command_builders/text_content_builder.rb
147
147
  - lib/gitlab/triage/engine.rb
148
148
  - lib/gitlab/triage/entity_builders/issue_builder.rb
149
+ - lib/gitlab/triage/errors.rb
150
+ - lib/gitlab/triage/errors/network.rb
149
151
  - lib/gitlab/triage/expand_condition.rb
150
152
  - lib/gitlab/triage/expand_condition/expansion.rb
151
153
  - lib/gitlab/triage/expand_condition/list.rb