mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 21:47:41 +00:00
refactor(error): refactor standard throws to non-retryable ApplicationFailure in workflows and activities
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { WorkflowTask } from '@/generated/prisma/client'
|
||||
import { ApplicationFailure } from '@temporalio/workflow'
|
||||
import {
|
||||
getActivities,
|
||||
executeActivity,
|
||||
@@ -39,7 +40,12 @@ export async function transcodeMedia(task: WorkflowTask): Promise<void> {
|
||||
// 2. Get Asset
|
||||
const asset = await executeActivity(TaskQueueDb, getAssetActivity, task.assetId)
|
||||
const key = asset?.storageKey?.key
|
||||
if (!asset || !key) throw new Error('Asset not found or has no key')
|
||||
if (!asset || !key) {
|
||||
throw ApplicationFailure.create({
|
||||
message: 'Asset not found or has no key',
|
||||
nonRetryable: true,
|
||||
})
|
||||
}
|
||||
|
||||
// 3. Get Worker-Specific Queue for Transcode
|
||||
workerQueue = await executeActivity(TaskQueueTranscode, getTranscodeWorkerQueueActivity)
|
||||
|
||||
Reference in New Issue
Block a user