callback events

This commit is contained in:
mrjvs
2023-08-24 21:51:43 +02:00
parent ef766936dd
commit ffe5cf5369
8 changed files with 120 additions and 15 deletions

View File

@@ -1,7 +1,13 @@
import { UseableFetcher } from '@/fetchers/types';
export interface ScrapeContext {
export type ScrapeContext = {
proxiedFetcher: UseableFetcher;
fetcher: UseableFetcher;
progress(val: number): void;
}
};
export type EmbedInput = {
url: string;
};
export type EmbedScrapeContext = EmbedInput & ScrapeContext;

6
src/utils/errors.ts Normal file
View File

@@ -0,0 +1,6 @@
export class NotFoundError extends Error {
constructor(reason?: string) {
super(`Couldn't found a stream: ${reason ?? 'not found'}`);
this.name = 'NotFoundError';
}
}