-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from
sentry-raven
to sentry-ruby
- Loading branch information
1 parent
825e2f0
commit fe8e3f2
Showing
24 changed files
with
223 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
module Sentry | ||
class << self | ||
sig { params(_blk: T.proc.params(arg0: Sentry::Configuration).void).void } | ||
def init(&_blk); end | ||
|
||
sig { params(exception: Exception, options: T.untyped).void } | ||
def capture_exception(exception, **options); end | ||
end | ||
|
||
class Configuration | ||
sig { returns(T.nilable(::Logger)) } | ||
attr_accessor :logger | ||
|
||
sig { returns(T.nilable(String)) } | ||
attr_accessor :project_root | ||
|
||
sig { returns(T.nilable(::Regexp)) } | ||
attr_accessor :app_dirs_pattern | ||
|
||
sig do | ||
params( | ||
value: T.proc | ||
.params( | ||
event: ::Sentry::Event, | ||
hint: T::Hash[Symbol, T.untyped] | ||
) | ||
.returns(::Sentry::Event) | ||
).void | ||
end | ||
def before_send=(value); end | ||
end | ||
|
||
class Event; end | ||
|
||
class ErrorEvent < ::Sentry::Event | ||
sig { returns(::Sentry::ExceptionInterface) } | ||
attr_reader :exception | ||
end | ||
|
||
class ExceptionInterface | ||
sig { returns(T::Array[::Sentry::SingleExceptionInterface]) } | ||
attr_reader :values | ||
end | ||
|
||
class SingleExceptionInterface | ||
sig { returns(String) } | ||
attr_accessor :value | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
|
||
module Dependabot | ||
module Sentry | ||
class Processor | ||
extend T::Sig | ||
extend T::Helpers | ||
|
||
abstract! | ||
|
||
# Process an event before it is sent to Sentry | ||
sig do | ||
abstract | ||
.params( | ||
event: ::Sentry::Event, | ||
hint: T::Hash[Symbol, T.untyped] | ||
) | ||
.returns(::Sentry::Event) | ||
end | ||
def process(event, hint); end | ||
|
||
# The default processor chain. | ||
# This chain is applied in the order of the array. | ||
sig { params(event: ::Sentry::Event, hint: T::Hash[Symbol, T.untyped]).returns(::Sentry::Event) } | ||
def self.process_chain(event, hint) | ||
[ExceptionSanitizer, SentryContext].reduce(event) do |acc, processor| | ||
processor.new.process(acc, hint) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
|
||
require "dependabot/sentry/processor" | ||
|
||
class SentryContext < ::Dependabot::Sentry::Processor | ||
sig do | ||
override | ||
.params( | ||
event: Sentry::Event, | ||
hint: T::Hash[Symbol, T.untyped] | ||
) | ||
.returns(Sentry::Event) | ||
end | ||
def process(event, hint) | ||
if (exception = hint[:exception]) | ||
exception.raven_context.each do |key, value| | ||
event.send("#{key}=", value) | ||
end | ||
end | ||
event | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.