Skip to content

Commit

Permalink
Report id becomes subtype
Browse files Browse the repository at this point in the history
  • Loading branch information
amortemousque committed Mar 2, 2022
1 parent 9b236d8 commit df6f027
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/domain/report/reportObservable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('report observable', () => {
expect(report).toEqual(
jasmine.objectContaining({
message: `${type}: foo bar`,
id: 'NavigatorVibrate',
subtype: 'NavigatorVibrate',
type,
})
)
Expand All @@ -52,8 +52,8 @@ describe('report observable', () => {
expect(notifyReport).toHaveBeenCalledOnceWith({
message: `csp_violation: 'blob' blocked by 'worker-src' directive`,
type: 'csp_violation',
id: 'csp_violation',
stack: `csp_violation: 'blob' blocked by 'worker-src' directive
subtype: 'worker-src',
stack: `worker-src: 'blob' blocked by 'worker-src' directive
at <anonymous> @ http://foo.bar/index.js:17:8`,
})
})
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/domain/report/reportObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type RawReportType = typeof RawReportType[keyof typeof RawReportType]

export interface RawReport {
type: RawReportType
id: string
subtype: string
message: string
stack?: string
}
Expand Down Expand Up @@ -76,7 +76,7 @@ function createCspViolationReportObservable() {
function buildRawReportFromReport({ type, body }: Report): RawReport {
return {
type,
id: body.id,
subtype: body.id,
message: `${type}: ${body.message}`,
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
}
Expand All @@ -86,10 +86,10 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
const type = RawReportType.cspViolation
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive`
return {
type,
id: type,
type: RawReportType.cspViolation,
subtype: event.effectiveDirective,
message: `${type}: ${message}`,
stack: buildStack(type, message, event.sourceFile, event.lineNumber, event.columnNumber),
stack: buildStack(event.effectiveDirective, message, event.sourceFile, event.lineNumber, event.columnNumber),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function trackReportError(errorObservable: Observable<RawError>) {
startClocks: clocksNow(),
message: reportError.message,
stack: reportError.stack,
type: reportError.id,
type: reportError.subtype,
source: ErrorSource.REPORT,
handling: ErrorHandling.UNHANDLED,
})
Expand Down

0 comments on commit df6f027

Please sign in to comment.