Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Action] Using error source from connector type executo…
…rs if defined. (elastic#184015) Resolves elastic#180419 ## Summary Updates action executor to use error source from errors thrown within the connector type executor, defaulting to framework error if no error source is specified. ## To Verify Modify the server log connector to throw a user error: ``` --- a/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts @@ -14,6 +14,7 @@ import type { ActionTypeExecutorOptions as ConnectorTypeExecutorOptions, ActionTypeExecutorResult as ConnectorTypeExecutorResult, } from '@kbn/actions-plugin/server/types'; +import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { AlertingConnectorFeatureId, UptimeConnectorFeatureId, @@ -78,6 +79,7 @@ async function executor( execOptions: ServerLogConnectorTypeExecutorOptions ): Promise<ConnectorTypeExecutorResult<void>> { const { actionId, params, logger } = execOptions; + throw createTaskRunError(new Error('fail'), TaskErrorSource.USER); const sanitizedMessage = withoutControlCharacters(params.message); ``` Create a rule that will trigger a server log action. Let the action run and then check the metrics endpoint at https://localhost:5601/api/task_manager/metrics?reset=false to see that this error was captured as a user error. Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information