diff --git a/packages/core/src/baseclient.ts b/packages/core/src/baseclient.ts index c50403ab3903..88f543a6f97e 100644 --- a/packages/core/src/baseclient.ts +++ b/packages/core/src/baseclient.ts @@ -545,7 +545,7 @@ export abstract class BaseClient implements Client { return finalEvent.event_id; }, reason => { - IS_DEBUG_BUILD && logger.error(reason); + IS_DEBUG_BUILD && logger.warn(reason); return undefined; }, ); diff --git a/packages/core/test/lib/base.test.ts b/packages/core/test/lib/base.test.ts index feb18390c3e8..476fcbdbb87d 100644 --- a/packages/core/test/lib/base.test.ts +++ b/packages/core/test/lib/base.test.ts @@ -940,13 +940,13 @@ describe('BaseClient', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSend }); const client = new TestClient(options); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerErrorSpy = jest.spyOn(logger, 'error'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); client.captureEvent({ message: 'hello' }); expect(TestClient.instance!.event).toBeUndefined(); expect(captureExceptionSpy).not.toBeCalled(); - expect(loggerErrorSpy).toBeCalledWith(new SentryError('`beforeSend` returned `null`, will not send event.')); + expect(loggerWarnSpy).toBeCalledWith(new SentryError('`beforeSend` returned `null`, will not send event.')); }); test('calls beforeSend and log info about invalid return value', () => { @@ -958,12 +958,12 @@ describe('BaseClient', () => { // @ts-ignore we need to test regular-js behavior const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSend }); const client = new TestClient(options); - const loggerErrorSpy = jest.spyOn(logger, 'error'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); client.captureEvent({ message: 'hello' }); expect(TestClient.instance!.event).toBeUndefined(); - expect(loggerErrorSpy).toBeCalledWith( + expect(loggerWarnSpy).toBeCalledWith( new SentryError('`beforeSend` method has to return `null` or a valid event.'), ); } @@ -1091,7 +1091,7 @@ describe('BaseClient', () => { const client = new TestClient(getDefaultTestClientOptions({ dsn: PUBLIC_DSN })); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerErrorSpy = jest.spyOn(logger, 'error'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); const scope = new Scope(); scope.addEventProcessor(() => null); @@ -1099,7 +1099,7 @@ describe('BaseClient', () => { expect(TestClient.instance!.event).toBeUndefined(); expect(captureExceptionSpy).not.toBeCalled(); - expect(loggerErrorSpy).toBeCalledWith(new SentryError('An event processor returned null, will not send event.')); + expect(loggerWarnSpy).toBeCalledWith(new SentryError('An event processor returned null, will not send event.')); }); // TODO(v7): Add back tests with client reports @@ -1131,7 +1131,7 @@ describe('BaseClient', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN }); const client = new TestClient(options); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerErrorSpy = jest.spyOn(logger, 'error'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); const scope = new Scope(); const exception = new Error('sorry'); scope.addEventProcessor(() => { @@ -1147,7 +1147,7 @@ describe('BaseClient', () => { }, originalException: exception, }); - expect(loggerErrorSpy).toBeCalledWith( + expect(loggerWarnSpy).toBeCalledWith( new SentryError( `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${exception}`, ), diff --git a/packages/nextjs/test/index.client.test.ts b/packages/nextjs/test/index.client.test.ts index 5d7053c00def..a143591ad8f0 100644 --- a/packages/nextjs/test/index.client.test.ts +++ b/packages/nextjs/test/index.client.test.ts @@ -14,7 +14,7 @@ const global = getGlobalObject(); const reactInit = jest.spyOn(SentryReact, 'init'); const captureEvent = jest.spyOn(BaseClient.prototype, 'captureEvent'); -const logError = jest.spyOn(logger, 'error'); +const logWarn = jest.spyOn(logger, 'warn'); describe('Client init()', () => { afterEach(() => { @@ -75,7 +75,7 @@ describe('Client init()', () => { expect(transportSend).not.toHaveBeenCalled(); expect(captureEvent.mock.results[0].value).toBeUndefined(); - expect(logError).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.')); + expect(logWarn).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.')); }); describe('integrations', () => { diff --git a/packages/nextjs/test/index.server.test.ts b/packages/nextjs/test/index.server.test.ts index 477ad252cd29..d926d8bbd57e 100644 --- a/packages/nextjs/test/index.server.test.ts +++ b/packages/nextjs/test/index.server.test.ts @@ -16,7 +16,7 @@ const global = getGlobalObject(); (global as typeof global & { __rewriteFramesDistDir__: string }).__rewriteFramesDistDir__ = '.next'; const nodeInit = jest.spyOn(SentryNode, 'init'); -const logError = jest.spyOn(logger, 'error'); +const logWarn = jest.spyOn(logger, 'warn'); describe('Server init()', () => { afterEach(() => { @@ -104,7 +104,7 @@ describe('Server init()', () => { await SentryNode.flush(); expect(transportSend).not.toHaveBeenCalled(); - expect(logError).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.')); + expect(logWarn).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.')); }); it("initializes both global hub and domain hub when there's an active domain", () => {