-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Convert ErrorReporting to a Service to use DI. Add some tests (no-changelog) #11279
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏🏻
import { Service } from 'typedi'; | ||
|
||
@Service() | ||
export class ErrorReporting { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
export class ErrorReporting { | |
export class ErrorReporter { |
|
||
import { ErrorReporting } from '../error-reporting'; | ||
|
||
describe('ErrorReporting', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
describe('ErrorReporting', () => { | |
describe('ErrorReporter', () => { |
) {} | ||
|
||
async init() { | ||
if (this.initialized) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw instead? We should prevent multiple init
calls from existing.
|
||
initialized = true; | ||
}; | ||
beforeSend(event: ErrorEvent, { originalException }: EventHint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeSend(event: ErrorEvent, { originalException }: EventHint) { | |
private beforeSend(event: ErrorEvent, { originalException }: EventHint) { |
export class ErrorReporting { | ||
private initialized = false; | ||
|
||
private seenErrors = new Set<string>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private seenErrors = new Set<string>(); | |
/** Hashes of error stack traces, to deduplicate error reports. */ | |
private readonly seenErrors = new Set<string>(); |
PAY-2113
Review / Merge checklist