Skip to content

Commit

Permalink
Small code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Jan 31, 2020
1 parent e776776 commit 8b11a5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ describe('delete()', () => {
await alertsClient.delete({ id: '1' });
expect(alertsClientParams.invalidateAPIKey).not.toHaveBeenCalled();
expect(alertsClientParams.logger.error).toHaveBeenCalledWith(
'delete(): Failed to load API key to invalidate: Fail'
'delete(): Failed to load API key to invalidate on alert 1: Fail'
);
});

Expand Down
6 changes: 4 additions & 2 deletions x-pack/legacy/plugins/alerting/server/alerts_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ export class AlertsClient {
.getDecryptedAsInternalUser<RawAlert>('alert', id, { namespace: this.namespace })
.then(result => result.attributes.apiKey)
.catch(e =>
this.logger.error(`delete(): Failed to load API key to invalidate: ${e.message}`)
this.logger.error(
`delete(): Failed to load API key to invalidate on alert ${id}: ${e.message}`
)
),
]);

const removeResult = await this.savedObjectsClient.delete('alert', id);

await Promise.all([
taskIdToRemove ? this.taskManager.remove(taskIdToRemove) : null,
taskIdToRemove && this.taskManager.remove(taskIdToRemove),
apiKeyToInvalidate && this.invalidateApiKey({ apiKey: apiKeyToInvalidate }),
]);

Expand Down

0 comments on commit 8b11a5c

Please sign in to comment.