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
db417054
Commit
db417054
authored
Mar 17, 2020
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle errors with repos api
parent
13851f12
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
app/workers/error_tracking_issue_link_worker.rb
app/workers/error_tracking_issue_link_worker.rb
+4
-0
spec/workers/error_tracking_issue_link_worker_spec.rb
spec/workers/error_tracking_issue_link_worker_spec.rb
+14
-0
No files found.
app/workers/error_tracking_issue_link_worker.rb
View file @
db417054
...
...
@@ -63,6 +63,10 @@ class ErrorTrackingIssueLinkWorker # rubocop:disable Scalability/IdempotentWorke
sentry_client
.
repos
(
organization_slug
)
.
find
{
|
repo
|
repo
.
project_id
==
issue
.
project_id
&&
repo
.
status
==
'active'
}
rescue
Sentry
::
Client
::
Error
=>
e
logger
.
info
(
"Unable to retrieve Sentry repo for organization
#{
organization_slug
}
, id
#{
sentry_issue_id
}
, with error:
#{
e
.
message
}
"
)
nil
end
def
organization_slug
...
...
spec/workers/error_tracking_issue_link_worker_spec.rb
View file @
db417054
...
...
@@ -95,5 +95,19 @@ describe ErrorTrackingIssueLinkWorker do
it_behaves_like
'attempts to create a link via plugin'
end
context
'when Sentry repos request errors'
do
it
'falls back to creating a link via plugin'
do
expect_next_instance_of
(
Sentry
::
Client
)
do
|
client
|
expect
(
client
).
to
receive
(
:repos
).
with
(
'sentry-org'
).
and_raise
(
Sentry
::
Client
::
Error
)
expect
(
client
)
.
to
receive
(
:create_issue_link
)
.
with
(
nil
,
sentry_issue
.
sentry_issue_identifier
,
issue
)
.
and_return
(
true
)
end
expect
(
subject
).
to
be
true
end
end
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