Skip to content

Commit

Permalink
fix: handle missing srt-source in api on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Nov 11, 2024
1 parent 2e95afc commit ae9b9fb
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ export async function DELETE(
false
)
: 0;
return await deleteSrtSource(ingestUuid || '', sourceId || 0)
if (!ingestUuid) {
return new NextResponse(`Ingest UUID not found in API`, { status: 404 });
}
if (!sourceId) {
return new NextResponse(`Source not found in API`, { status: 404 });
}
return await deleteSrtSource(ingestUuid, sourceId)
.then((response) => {
return new NextResponse(JSON.stringify(response));
})
.catch((error) => {
Log().error(error);
const errorResponse = {
ok: false,
error: 'unexpected'
error: 'Failed to delete SRT source'
};
return new NextResponse(JSON.stringify(errorResponse), { status: 500 });
});
Expand Down

0 comments on commit ae9b9fb

Please sign in to comment.