- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
|
|
import { FlowRunStatus } from '@activepieces/shared'
|
|
import { codeExecutor } from '../../src/lib/handler/code-executor'
|
|
import { FlowExecutorContext } from '../../src/lib/handler/context/flow-execution-context'
|
|
import { pieceExecutor } from '../../src/lib/handler/piece-executor'
|
|
import { buildCodeAction, buildPieceAction, generateMockEngineConstants } from './test-helper'
|
|
|
|
describe('code piece with error handling', () => {
|
|
|
|
it('should continue on failure when execute code a code that throws an error', async () => {
|
|
const result = await codeExecutor.handle({
|
|
action: buildCodeAction({
|
|
name: 'runtime',
|
|
input: {},
|
|
errorHandlingOptions: {
|
|
continueOnFailure: {
|
|
value: true,
|
|
},
|
|
retryOnFailure: {
|
|
value: false,
|
|
},
|
|
},
|
|
}), executionState: FlowExecutorContext.empty(), constants: generateMockEngineConstants(),
|
|
})
|
|
expect(result.verdict).toStrictEqual({
|
|
status: FlowRunStatus.RUNNING,
|
|
})
|
|
expect(result.steps.runtime.status).toEqual('FAILED')
|
|
expect(result.steps.runtime.errorMessage).toContain('Custom Runtime Error')
|
|
})
|
|
|
|
})
|
|
|
|
describe('piece with error handling', () => {
|
|
|
|
it('should continue on failure when piece fails', async () => {
|
|
const result = await pieceExecutor.handle({
|
|
action: buildPieceAction({
|
|
name: 'send_http',
|
|
pieceName: '@activepieces/piece-http',
|
|
actionName: 'send_request',
|
|
input: {
|
|
'method': 'POST',
|
|
'url': 'https://cloud.activepieces.com/api/v1/flags',
|
|
'headers': {},
|
|
'queryParams': {},
|
|
'body_type': 'none',
|
|
'body': {},
|
|
},
|
|
errorHandlingOptions: {
|
|
continueOnFailure: {
|
|
value: true,
|
|
},
|
|
retryOnFailure: {
|
|
value: false,
|
|
},
|
|
},
|
|
}), executionState: FlowExecutorContext.empty(), constants: generateMockEngineConstants(),
|
|
})
|
|
|
|
const expectedError = {
|
|
response: {
|
|
status: 404,
|
|
body: {
|
|
statusCode: 404,
|
|
error: 'Not Found',
|
|
message: 'Route not found',
|
|
},
|
|
},
|
|
request: {},
|
|
}
|
|
|
|
expect(result.verdict).toStrictEqual({
|
|
status: FlowRunStatus.RUNNING,
|
|
})
|
|
expect(result.steps.send_http.status).toBe('FAILED')
|
|
expect(result.steps.send_http.errorMessage).toEqual(JSON.stringify(expectedError, null, 2))
|
|
|
|
}, 10000)
|
|
|
|
})
|