Skip to content

feat(core): Ensure originalException has type unknown #7361

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

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
data: {
__sentry__: true,
},
originalException: reason as Error,
originalException: reason,
});
throw new SentryError(
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ export class Hub implements HubInterface {
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public captureException(exception: any, hint?: EventHint): string {
public captureException(exception: unknown, hint?: EventHint): string {
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
const syntheticException = new Error('Sentry syntheticException');
this._withClient((client, scope) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/node/src/integrations/onunhandledrejection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export class OnUnhandledRejection implements Integration {
* @param reason string
* @param promise promise
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
public sendUnhandledPromise(reason: any, promise: any): void {
public sendUnhandledPromise(reason: unknown, promise: unknown): void {
const hub = getCurrentHub();
if (hub.getIntegration(OnUnhandledRejection)) {
hub.withScope((scope: Scope) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface EventHint {
event_id?: string;
captureContext?: CaptureContext;
syntheticException?: Error | null;
originalException?: Error | string | null;
originalException?: unknown;
attachments?: Attachment[];
data?: any;
integrations?: string[];
Expand Down