Skip to content

Commit

Permalink
Throw if there is no mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Apr 23, 2021
1 parent 7cb3b76 commit dbbc2f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion x-pack/plugins/cases/server/client/cases/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export const push = async (
connectorId: connector.id,
connectorType: connector.actionTypeId,
});

if (connectorMappings.length === 0) {
throw new Error('Connector mapping has not been created');
}
} catch (e) {
const message = `Error getting mapping for connector with id ${connector.id}: ${e.message}`;
throw createCaseError({ message, error: e, logger });
Expand All @@ -131,7 +135,7 @@ export const push = async (
theCase,
userActions,
connector: connector as ActionConnector,
mappings: connectorMappings,
mappings: connectorMappings[0].attributes.mappings,
alerts,
});
} catch (e) {
Expand Down

0 comments on commit dbbc2f3

Please sign in to comment.