mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
chore: better debug logs in slack app (#7467)
Should improve the readability of our Slack App integration logs.
This commit is contained in:
parent
4c1d8dd423
commit
47b0c61670
@ -38,7 +38,9 @@ describe('SlackAppAddon', () => {
|
||||
const getLogger = jest.fn(() => loggerMock);
|
||||
const mockError = {
|
||||
code: ErrorCode.PlatformError,
|
||||
data: 'Platform error message',
|
||||
data: {
|
||||
error: 'Platform error message',
|
||||
},
|
||||
};
|
||||
|
||||
const event: IEvent = {
|
||||
@ -150,7 +152,7 @@ describe('SlackAppAddon', () => {
|
||||
});
|
||||
|
||||
expect(loggerMock.warn).toHaveBeenCalledWith(
|
||||
`Error handling event ${event.type}. A platform error occurred: Platform error message`,
|
||||
`Error handling event ${event.type}. A platform error occurred: ${JSON.stringify(mockError.data)}`,
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
@ -178,7 +180,7 @@ describe('SlackAppAddon', () => {
|
||||
|
||||
expect(postMessage).toHaveBeenCalledTimes(3);
|
||||
expect(loggerMock.warn).toHaveBeenCalledWith(
|
||||
`Error handling event ${FEATURE_ENVIRONMENT_ENABLED}. A platform error occurred: Platform error message`,
|
||||
`Error handling event ${FEATURE_ENVIRONMENT_ENABLED}. A platform error occurred: ${JSON.stringify(mockError.data)}`,
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(loggerMock.info).toHaveBeenCalledWith(
|
||||
|
@ -67,7 +67,9 @@ export default class SlackAppAddon extends Addon {
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.logger.debug(`Found candidate channels: ${eventChannels}.`);
|
||||
this.logger.debug(
|
||||
`Found candidate channels: ${JSON.stringify(eventChannels)}.`,
|
||||
);
|
||||
|
||||
if (!this.slackClient || this.accessToken !== accessToken) {
|
||||
const client = new WebClient(accessToken);
|
||||
@ -162,13 +164,13 @@ export default class SlackAppAddon extends Addon {
|
||||
if (error.code === ErrorCode.PlatformError) {
|
||||
const { data } = error as WebAPIPlatformError;
|
||||
this.logger.warn(
|
||||
`Error handling event ${event.type}. A platform error occurred: ${data}`,
|
||||
`Error handling event ${event.type}. A platform error occurred: ${JSON.stringify(data)}`,
|
||||
error,
|
||||
);
|
||||
} else if (error.code === ErrorCode.RequestError) {
|
||||
const { original } = error as WebAPIRequestError;
|
||||
this.logger.warn(
|
||||
`Error handling event ${event.type}. A request error occurred: ${original}`,
|
||||
`Error handling event ${event.type}. A request error occurred: ${JSON.stringify(original)}`,
|
||||
error,
|
||||
);
|
||||
} else if (error.code === ErrorCode.RateLimitedError) {
|
||||
|
Loading…
Reference in New Issue
Block a user