-
Notifications
You must be signed in to change notification settings - Fork 57
feat: migrate reporting service contract from logging to reporting module #1221
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
Changes from all commits
6bb1740
f8a0936
e573c1f
caf86dd
4adf5fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { IErrorReportingService, ISDKError } from './types'; | ||
|
|
||
| export class ErrorReportingDispatcher implements IErrorReportingService { | ||
| private services: IErrorReportingService[] = []; | ||
|
Check warning on line 4 in src/reporting/errorReportingDispatcher.ts
|
||
|
|
||
| public register(service: IErrorReportingService): void { | ||
| this.services.push(service); | ||
| } | ||
|
|
||
| public report(error: ISDKError): void { | ||
| this.services.forEach(s => s.report(error)); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dispatcher fan-out lacks error isolation between servicesMedium Severity
Additional Locations (2) |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { ILoggingService, ISDKLogEntry } from './types'; | ||
|
|
||
| export class LoggingDispatcher implements ILoggingService { | ||
| private services: ILoggingService[] = []; | ||
|
Check warning on line 4 in src/reporting/loggingDispatcher.ts
|
||
|
|
||
| public register(service: ILoggingService): void { | ||
| this.services.push(service); | ||
| } | ||
|
|
||
| public log(entry: ISDKLogEntry): void { | ||
| this.services.forEach(s => s.log(entry)); | ||
| } | ||
| } | ||


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.
Register methods crash when called before init
High Severity
registerErrorReportingServiceandregisterLoggingServiceaccessself._ErrorReportingDispatcherandself._LoggingDispatcherdirectly without null guards, but these dispatchers are only created insiderunPreConfigFetchInitialization(called duringinit()). Calling either registration method beforeinit()throws aTypeError. Other public API methods in this file (e.g.,setAppVersion,_setWrapperSDKInfo) usequeueIfNotInitializedto handle this scenario, but the new methods do not.Additional Locations (1)
src/mp-instance.ts#L1643-L1645