error logging

This commit is contained in:
mrjvs
2023-09-06 17:04:43 +02:00
parent 637b3b635a
commit d325dab162
3 changed files with 5 additions and 4 deletions

View File

@@ -29,7 +29,7 @@
"homepage": "https://github.com/movie-web/providers#readme", "homepage": "https://github.com/movie-web/providers#readme",
"scripts": { "scripts": {
"build": "vite build", "build": "vite build",
"test": "vitest run --coverage", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",
"lint": "eslint --ext .ts,.js src/", "lint": "eslint --ext .ts,.js src/",

View File

@@ -3,6 +3,7 @@ export type UpdateEventStatus = 'success' | 'failure' | 'notfound' | 'pending';
export type UpdateEvent = { export type UpdateEvent = {
percentage: number; percentage: number;
status: UpdateEventStatus; status: UpdateEventStatus;
error?: unknown;
}; };
export type InitEvent = { export type InitEvent = {

View File

@@ -1,8 +1,8 @@
import { UseableFetcher } from '@/fetchers/types'; import { UseableFetcher } from '@/fetchers/types';
import { FullScraperEvents } from '@/main/events'; import { FullScraperEvents } from '@/main/events';
import { ScrapeMedia } from '@/main/media'; import { ScrapeMedia } from '@/main/media';
import { ProviderList } from '@/providers/all';
import { EmbedOutput, SourcererOutput } from '@/providers/base'; import { EmbedOutput, SourcererOutput } from '@/providers/base';
import { ProviderList } from '@/providers/get';
import { Stream } from '@/providers/streams'; import { Stream } from '@/providers/streams';
import { ScrapeContext } from '@/utils/context'; import { ScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors'; import { NotFoundError } from '@/utils/errors';
@@ -85,8 +85,8 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
ops.events?.update?.({ ops.events?.update?.({
percentage: 100, percentage: 100,
status: 'failure', status: 'failure',
error: err,
}); });
// TODO log error
continue; continue;
} }
if (!output) throw new Error('Invalid media type'); if (!output) throw new Error('Invalid media type');
@@ -139,8 +139,8 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
ops.events?.update?.({ ops.events?.update?.({
percentage: 100, percentage: 100,
status: 'failure', status: 'failure',
error: err,
}); });
// TODO log error
continue; continue;
} }