Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: state machine improvements and error handling (SOFIE-3751) #207

Merged
merged 4 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Check that Quantel source clips exist earlier, to avoid crashing…
… out of a WorkInProgress.
nytamin committed Jan 23, 2025
commit 4c244b12713c3b3011e105e10c623424a41e2a9d
19 changes: 18 additions & 1 deletion shared/packages/worker/src/worker/accessorHandlers/quantel.ts
Original file line number Diff line number Diff line change
@@ -155,15 +155,31 @@ export class QuantelAccessorHandle<Metadata> extends GenericAccessorHandle<Metad

const clipSummary = await this.searchForLatestClip(quantel)

const content = this.getContent()

if (!clipSummary) {
const content = this.getContent()
return {
success: false,
packageExists: false,
reason: { user: `Clip not found`, tech: `Clip "${content.guid || content.title}" not found` },
}
}

// Verify that the clip does exist:
const clipData = await quantel.getClip(clipSummary.ClipID)
if (!clipData) {
return {
success: false,
packageExists: false,
reason: {
user: `Clip not found`,
tech: `Clip id ${clipSummary.ClipID} not found in this zone (although "${
content.guid || content.title
}" was found)`,
},
}
}

if (!parseInt(clipSummary.Frames, 10)) {
return {
success: false,
@@ -279,6 +295,7 @@ export class QuantelAccessorHandle<Metadata> extends GenericAccessorHandle<Metad
// Verify that the clip is of the right version:
const clipData = await quantel.getClip(readInfo.clipId)
if (!clipData) throw new Error(`Clip id ${readInfo.clipId} not found`)

if (clipData.Created !== readInfo.version.created)
throw new Error(
`Clip id ${readInfo.clipId} property "Created" doesn't match (${clipData.Created} vs ${readInfo.version.created})`