debian-mirror-gitlab/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb

39 lines
1.1 KiB
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
module Resolvers
module ErrorTracking
class SentryDetailedErrorResolver < BaseResolver
2021-01-29 00:20:46 +05:30
type Types::ErrorTracking::SentryDetailedErrorType, null: true
argument :id, ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError],
2020-01-01 13:55:28 +05:30
required: true,
description: 'ID of the Sentry issue'
2021-01-29 00:20:46 +05:30
def resolve(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError].coerce_isolated_input(id)
2020-01-01 13:55:28 +05:30
# Get data from Sentry
response = ::ErrorTracking::IssueDetailsService.new(
project,
current_user,
2021-01-29 00:20:46 +05:30
{ issue_id: id.model_id }
2020-01-01 13:55:28 +05:30
).execute
issue = response[:issue]
issue.gitlab_project = project if issue
issue
end
2020-03-13 15:44:24 +05:30
private
def project
return object.gitlab_project if object.respond_to?(:gitlab_project)
object
end
2020-01-01 13:55:28 +05:30
end
end
end