mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 11:33:25 +00:00
Modified the try-catch block
This commit is contained in:
@@ -88,22 +88,16 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||||||
if (!output || (!output.stream?.length && !output.embeds.length)) {
|
if (!output || (!output.stream?.length && !output.embeds.length)) {
|
||||||
throw new NotFoundError('No streams found');
|
throw new NotFoundError('No streams found');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
if (err instanceof NotFoundError) {
|
const updateParams: UpdateEvent = {
|
||||||
ops.events?.update?.({
|
|
||||||
id: source.id,
|
|
||||||
percentage: 100,
|
|
||||||
status: 'notfound',
|
|
||||||
reason: err.message,
|
|
||||||
});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ops.events?.update?.({
|
|
||||||
id: source.id,
|
id: source.id,
|
||||||
percentage: 100,
|
percentage: 100,
|
||||||
status: 'failure',
|
status: error instanceof NotFoundError ? 'notfound' : 'failure',
|
||||||
error: err,
|
reason: error instanceof NotFoundError ? error.message : undefined,
|
||||||
});
|
error: error instanceof NotFoundError ? undefined : error,
|
||||||
|
};
|
||||||
|
|
||||||
|
ops.events?.update?.(updateParams);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!output) throw new Error('Invalid media type');
|
if (!output) throw new Error('Invalid media type');
|
||||||
@@ -161,16 +155,11 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||||||
percentage: 100,
|
percentage: 100,
|
||||||
status: error instanceof NotFoundError ? 'notfound' : 'failure',
|
status: error instanceof NotFoundError ? 'notfound' : 'failure',
|
||||||
reason: error instanceof NotFoundError ? error.message : undefined,
|
reason: error instanceof NotFoundError ? error.message : undefined,
|
||||||
error,
|
error: error instanceof NotFoundError ? undefined : error,
|
||||||
};
|
};
|
||||||
|
|
||||||
ops.events?.update?.(updateParams);
|
ops.events?.update?.(updateParams);
|
||||||
|
continue;
|
||||||
if (error instanceof NotFoundError) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user