Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cbf6fe66
Commit
cbf6fe66
authored
Jan 07, 2021
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply backend maintainer feedback
parent
9110a745
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
9 deletions
+6
-9
lib/container_registry/client.rb
lib/container_registry/client.rb
+2
-2
lib/gitlab/faraday.rb
lib/gitlab/faraday.rb
+1
-1
lib/gitlab/faraday/error_callback.rb
lib/gitlab/faraday/error_callback.rb
+3
-4
spec/lib/gitlab/faraday/error_callback_spec.rb
spec/lib/gitlab/faraday/error_callback_spec.rb
+0
-2
No files found.
lib/container_registry/client.rb
View file @
cbf6fe66
...
...
@@ -176,7 +176,7 @@ module ContainerRegistry
yield
(
conn
)
if
block_given?
conn
.
request
(
:retry
,
RETRY_OPTIONS
)
conn
.
request
(
:error_callback
,
ERROR_CALLBACK_OPTIONS
)
conn
.
request
(
:
gitlab_
error_callback
,
ERROR_CALLBACK_OPTIONS
)
conn
.
adapter
:net_http
end
...
...
@@ -226,7 +226,7 @@ module ContainerRegistry
conn
.
request
:json
conn
.
request
(
:retry
,
RETRY_OPTIONS
)
conn
.
request
(
:error_callback
,
ERROR_CALLBACK_OPTIONS
)
conn
.
request
(
:
gitlab_
error_callback
,
ERROR_CALLBACK_OPTIONS
)
conn
.
adapter
:net_http
end
end
...
...
lib/gitlab/faraday.rb
View file @
cbf6fe66
...
...
@@ -2,6 +2,6 @@
module
Gitlab
module
Faraday
::
Faraday
::
Request
.
register_middleware
(
error_callback:
->
{
::
Gitlab
::
Faraday
::
ErrorCallback
})
::
Faraday
::
Request
.
register_middleware
(
gitlab_
error_callback:
->
{
::
Gitlab
::
Faraday
::
ErrorCallback
})
end
end
lib/gitlab/faraday/error_callback.rb
View file @
cbf6fe66
...
...
@@ -29,15 +29,14 @@ module Gitlab
def
call
(
env
)
@app
.
call
(
env
)
rescue
=>
e
@options
.
callback
.
call
(
env
,
e
)
@options
.
callback
&
.
call
(
env
,
e
)
raise
end
class
Options
<
::
Faraday
::
Options
.
new
(
:callback
)
DEFAULT_CALLBACK
=
->
(
_env
,
_exception
)
{
}
def
callback
self
[
:callback
]
||
DEFAULT_CALLBACK
self
[
:callback
]
end
end
end
...
...
spec/lib/gitlab/faraday/error_callback_spec.rb
View file @
cbf6fe66
...
...
@@ -26,8 +26,6 @@ RSpec.describe Gitlab::Faraday::ErrorCallback do
context
'with no callback'
do
it
'uses the default callback'
do
expect
(
Gitlab
::
Faraday
::
ErrorCallback
::
Options
::
DEFAULT_CALLBACK
).
to
receive
(
:call
).
and_call_original
expect
{
subject
}.
to
raise_error
(
ArgumentError
,
'Kaboom!'
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment